Ext.SplitButton=Ext.extend(Ext.Button,{
	arrowSelector:'em',
	split:true,
	initComponent:function(){
		Ext.SplitButton.superclass.initComponent.call(this);
		this.addEvents("arrowclick");
	},
	onRender:function(){
		Ext.SplitButton.superclass.onRender.apply(this,arguments);
		if(this.arrowTooltip){
			this.el.child(this.arrowSelector).dom[this.tooltipType]=this.arrowTooltip;
		}
	},
	setArrowHandler:function(handler,scope){
		this.arrowHandler=handler;
		this.scope=scope;
	},
	getMenuClass:function(){
		return'x-btn-split'+(this.arrowAlign=='bottom'?'-bottom':'');
	},
	isClickOnArrow:function(e){
		return this.arrowAlign!='bottom'?
			 e.getPageX()>this.el.child(this.buttonSelector).getRegion().right:
			 e.getPageY()>this.el.child(this.buttonSelector).getRegion().bottom;
	},
	onClick:function(e,t){
		e.preventDefault();
		if(!this.disabled){
			if(this.isClickOnArrow(e)){
				if(this.menu&&!this.menu.isVisible()&&!this.ignoreNextClick){
					this.showMenu();
				}
				this.fireEvent("arrowclick",this,e);
				if(this.arrowHandler){
					this.arrowHandler.call(this.scope||this,this,e);
				}
			}else{
				if(this.enableToggle){
					this.toggle();
				}
				this.fireEvent("click",this,e);
				if(this.handler){
					this.handler.call(this.scope||this,this,e);
				}
			}
		}
	},
	isMenuTriggerOver:function(e){
		return this.menu&&e.target.tagName=='em';
	},
	isMenuTriggerOut:function(e,internal){
		return this.menu&&e.target.tagName!='em';
	}});
Ext.reg('splitbutton',Ext.SplitButton);
Ext.CycleButton=Ext.extend(Ext.SplitButton,{
	getItemText:function(item){
		if(item&&this.showText===true){
			var text='';
			if(this.prependText){
				text+=this.prependText;
			}
			text+=item.text;
			return text;
		}
		return undefined;
	},
	setActiveItem:function(item,suppressEvent){
		if(typeof item!='object'){
			item=this.menu.items.get(item);
		}
		if(item){
			if(!this.rendered){
				this.text=this.getItemText(item);
				this.iconCls=item.iconCls;
			}else{
				var t=this.getItemText(item);
				if(t){
					this.setText(t);
				}
				this.setIconClass(item.iconCls);
			}
			this.activeItem=item;
			if(!item.checked){
				item.setChecked(true,true);
			}
			if(this.forceIcon){
				this.setIconClass(this.forceIcon);
			}
			if(!suppressEvent){
				this.fireEvent('change',this,item);
			}
		}
	},
	getActiveItem:function(){
		return this.activeItem;
	},
	initComponent:function(){
		this.addEvents(
			"change"
		);
		if(this.changeHandler){
			this.on('change',this.changeHandler,this.scope||this);
			delete this.changeHandler;
		}
		this.itemCount=this.items.length;
		this.menu={cls:'x-cycle-menu',items:[]};
		var checked;
		for(var i=0,len=this.itemCount;i<len;i++){
			var item=this.items[i];
			item.group=item.group||this.id;
			item.itemIndex=i;
			item.checkHandler=this.checkHandler;
			item.scope=this;
			item.checked=item.checked||false;
			this.menu.items.push(item);
			if(item.checked){
				checked=item;
			}
		}
		this.setActiveItem(checked,true);
		Ext.CycleButton.superclass.initComponent.call(this);
		this.on('click',this.toggleSelected,this);
	},
	checkHandler:function(item,pressed){
		if(pressed){
			this.setActiveItem(item);
		}
	},
	toggleSelected:function(){
		this.menu.render();
		var nextIdx,checkItem;
		for(var i=1;i<this.itemCount;i++){
			nextIdx=(this.activeItem.itemIndex+i)%this.itemCount;
			checkItem=this.menu.items.itemAt(nextIdx);
			if(!checkItem.disabled){
				checkItem.setChecked(true);
				break;
			}
		}
	}});
Ext.reg('cycle',Ext.CycleButton);
Ext.layout.ToolbarLayout=Ext.extend(Ext.layout.ContainerLayout,{
	monitorResize:true,
	triggerWidth:18,
	lastOverflow:false,
	noItemsMenuText:'<div class="x-toolbar-no-items">(None)</div>',
	onLayout:function(ct,target){
		if(!this.leftTr){
			target.addClass('x-toolbar-layout-ct');
			target.insertHtml('beforeEnd',
				'<table cellspacing="0" class="x-toolbar-ct"><tbody><tr><td class="x-toolbar-left" align="left"><table cellspacing="0"><tbody><tr class="x-toolbar-left-row"></tr></tbody></table></td><td class="x-toolbar-right" align="right"><table cellspacing="0" class="x-toolbar-right-ct"><tbody><tr><td><table cellspacing="0"><tbody><tr class="x-toolbar-right-row"></tr></tbody></table></td><td><table cellspacing="0"><tbody><tr class="x-toolbar-extras-row"></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>');
			this.leftTr=target.child('tr.x-toolbar-left-row',true);
			this.rightTr=target.child('tr.x-toolbar-right-row',true);
			this.extrasTr=target.child('tr.x-toolbar-extras-row',true);
		}
		var side=this.leftTr;
		var pos=0;
		var items=ct.items.items;
		for(var i=0,len=items.length,c;i<len;i++,pos++){
			c=items[i];
			if(c.isFill){
				side=this.rightTr;
				pos=-1;
			}else if(!c.rendered){
				c.render(this.insertCell(c,side,pos));
			}else{
				if(!c.xtbHidden&&!this.isValidParent(c,side.childNodes[pos])){
					var td=this.insertCell(c,side,pos);
					td.appendChild(c.getDomPositionEl().dom);
					c.container=Ext.get(td);
				}
			}
		}
		this.cleanup(this.leftTr);
		this.cleanup(this.rightTr);
		this.cleanup(this.extrasTr);
		this.fitToSize(target);
	},
	cleanup:function(row){
		var cn=row.childNodes;
		for(var i=cn.length-1,c;i>=0&&(c=cn[i]);i--){
			if(!c.firstChild){
				row.removeChild(c);
			}
		}
	},
	insertCell:function(c,side,pos){
		var td=document.createElement('td');
		td.className='x-toolbar-cell';
		side.insertBefore(td,side.childNodes[pos]||null);
		return td;
	},
	hideItem:function(item){
		var h=(this.hiddens=this.hiddens||[]);
		h.push(item);
		item.xtbHidden=true;
		item.xtbWidth=item.getDomPositionEl().dom.parentNode.offsetWidth;
		item.hide();
	},
	unhideItem:function(item){
		item.show();
		item.xtbHidden=false;
		this.hiddens.remove(item);
		if(this.hiddens.length<1){
			delete this.hiddens;
		}
	},
	getItemWidth:function(c){
		return c.hidden?(c.xtbWidth||0):c.getDomPositionEl().dom.parentNode.offsetWidth;
	},
	fitToSize:function(t){
		if(this.container.enableOverflow===false){
			return;
		}
		var w=t.dom.clientWidth;
		var lw=this.lastWidth||0;
		this.lastWidth=w;
		var iw=t.dom.firstChild.offsetWidth;
		var clipWidth=w-this.triggerWidth;
		var hideIndex=-1;
		if(iw>w||(this.hiddens&&w>=lw)){
			var i,items=this.container.items.items,len=items.length,c;
			var loopWidth=0;
			for(i=0;i<len;i++){
				c=items[i];
				if(!c.isFill){
					loopWidth+=this.getItemWidth(c);
					if(loopWidth>clipWidth){
						if(!c.xtbHidden){
							this.hideItem(c);
						}
					}else{
						if(c.xtbHidden){
							this.unhideItem(c);
						}
					}
				}
			}
		}
		if(this.hiddens){
			this.initMore();
			if(!this.lastOverflow){
				this.container.fireEvent('overflowchange',this.container,true);
				this.lastOverflow=true;
			}
		}else if(this.more){
			this.clearMenu();
			this.more.destroy();
			delete this.more;
			if(this.lastOverflow){
				this.container.fireEvent('overflowchange',this.container,false);
				this.lastOverflow=false;
			}
		}
	},
	createMenuConfig:function(c,hideOnClick){
		var cfg=Ext.apply({},c.initialConfig),
			group=c.toggleGroup;
		Ext.apply(cfg,{
			text:c.overflowText||c.text,
			iconCls:c.iconCls,
			icon:c.icon,
			itemId:c.itemId,
			disabled:c.disabled,
			handler:c.handler,
			scope:c.scope,
			menu:c.menu,
			hideOnClick:hideOnClick
		});
		if(group||c.enableToggle){
			Ext.apply(cfg,{
				group:group,
				checked:c.pressed,
				listeners:{
					checkchange:function(item,checked){
						c.toggle(checked);
					}
				}
			});
		}
		delete cfg.xtype;
		delete cfg.id;
		return cfg;
	},
	addComponentToMenu:function(m,c){
		if(c instanceof Ext.Toolbar.Separator){
			m.add('-');
		}else if(Ext.isFunction(c.isXType)){
			if(c.isXType('splitbutton')){
				m.add(this.createMenuConfig(c,true));
			}else if(c.isXType('button')){
				m.add(this.createMenuConfig(c,!c.menu));
			}else if(c.isXType('buttongroup')){
				c.items.each(function(item){
					 this.addComponentToMenu(m,item);
				},this);
			}
		}
	},
	clearMenu:function(){
		var m=this.moreMenu;
		if(m&&m.items){
			this.moreMenu.items.each(function(item){
				delete item.menu;
			});
		}
	},
	beforeMoreShow:function(m){
		var h=this.container.items.items,
			len=h.length,
			c,
			prev,
			needsSep=function(group,item){
				return group.isXType('buttongroup')&&!(item instanceof Ext.Toolbar.Separator);
			};
		this.clearMenu();
		m.removeAll();
		for(var i=0;i<len;i++){
			c=h[i];
			if(c.xtbHidden){
				if(prev&&(needsSep(c,prev)||needsSep(prev,c))){
					m.add('-');
				}
				this.addComponentToMenu(m,c);
				prev=c;
			}
		}
		if(m.items.length<1){
			m.add(this.noItemsMenuText);
		}
	},
	initMore:function(){
		if(!this.more){
			this.moreMenu=new Ext.menu.Menu({
				listeners:{
					beforeshow:this.beforeMoreShow,
					scope:this
				}
			});
			this.more=new Ext.Button({
				iconCls:'x-toolbar-more-icon',
				cls:'x-toolbar-more',
				menu:this.moreMenu
			});
			var td=this.insertCell(this.more,this.extrasTr,100);
			this.more.render(td);
		}
	},
	destroy:function(){
		Ext.destroy(this.more,this.moreMenu);
		Ext.layout.ToolbarLayout.superclass.destroy.call(this);
	}
	});
Ext.Container.LAYOUTS.toolbar=Ext.layout.ToolbarLayout;
Ext.Toolbar=function(config){
	if(Ext.isArray(config)){
		config={items:config,layout:'toolbar'};
	}else{
		config=Ext.apply({
			layout:'toolbar'
		},config);
		if(config.buttons){
			config.items=config.buttons;
		}
	}
	Ext.Toolbar.superclass.constructor.call(this,config);};
(function(){
var T=Ext.Toolbar;
Ext.extend(T,Ext.Container,{
	defaultType:'button',
	trackMenus:true,
	internalDefaults:{removeMode:'container',hideParent:true},
	toolbarCls:'x-toolbar',
	initComponent:function(){
		T.superclass.initComponent.call(this);
		this.addEvents('overflowchange');
	},
	onRender:function(ct,position){
		if(!this.el){
			if(!this.autoCreate){
				this.autoCreate={
					cls:this.toolbarCls+' x-small-editor'
				};
			}
			this.el=ct.createChild(Ext.apply({id:this.id},this.autoCreate),position);
		}
	},
	lookupComponent:function(c){
		if(Ext.isString(c)){
			if(c=='-'){
				c=new T.Separator();
			}else if(c==' '){
				c=new T.Spacer();
			}else if(c=='->'){
				c=new T.Fill();
			}else{
				c=new T.TextItem(c);
			}
			this.applyDefaults(c);
		}else{
			if(c.isFormField||c.render){
				c=this.constructItem(c);
			}else if(c.tag){
				c=new T.Item({autoEl:c});
			}else if(c.tagName){
				c=new T.Item({el:c});
			}else if(Ext.isObject(c)){
				c=c.xtype?this.constructItem(c):this.constructButton(c);
			}
		}
		return c;
	},
	applyDefaults:function(c){
		if(!Ext.isString(c)){
			c=Ext.Toolbar.superclass.applyDefaults.call(this,c);
			var d=this.internalDefaults;
			if(c.events){
				Ext.applyIf(c.initialConfig,d);
				Ext.apply(c,d);
			}else{
				Ext.applyIf(c,d);
			}
		}
		return c;
	},
	constructItem:function(item,type){
		return Ext.create(item,type||this.defaultType);
	},
	addSeparator:function(){
		return this.add(new T.Separator());
	},
	addSpacer:function(){
		return this.add(new T.Spacer());
	},
	addFill:function(){
		this.add(new T.Fill());
	},
	addElement:function(el){
		return this.addItem(new T.Item({el:el}));
	},
	addItem:function(item){
		return Ext.Toolbar.superclass.add.apply(this,arguments);
	},
	addButton:function(config){
		if(Ext.isArray(config)){
			var buttons=[];
			for(var i=0,len=config.length;i<len;i++){
				buttons.push(this.addButton(config[i]));
			}
			return buttons;
		}
		return this.add(this.constructButton(config));
	},
	addText:function(text){
		return this.addItem(new T.TextItem(text));
	},
	addDom:function(config){
		return this.add(new T.Item({autoEl:config}));
	},
	addField:function(field){
		return this.add(field);
	},
	insertButton:function(index,item){
		if(Ext.isArray(item)){
			var buttons=[];
			for(var i=0,len=item.length;i<len;i++){
			 buttons.push(this.insertButton(index+i,item[i]));
			}
			return buttons;
		}
		return Ext.Toolbar.superclass.insert.call(this,index,item);
	},
	initMenuTracking:function(item){
		if(this.trackMenus&&item.menu){
			this.mon(item,{
				'menutriggerover':this.onButtonTriggerOver,
				'menushow':this.onButtonMenuShow,
				'menuhide':this.onButtonMenuHide,
				scope:this
			});
		}
	},
	constructButton:function(item){
		var b=item.events?item:this.constructItem(item,item.split?'splitbutton':this.defaultType);
		this.initMenuTracking(b);
		return b;
	},
	onDisable:function(){
		this.items.each(function(item){
			 if(item.disable){
				 item.disable();
			}
		});
	},
	onEnable:function(){
		this.items.each(function(item){
			 if(item.enable){
				 item.enable();
			}
		});
	},
	onButtonTriggerOver:function(btn){
		if(this.activeMenuBtn&&this.activeMenuBtn!=btn){
			this.activeMenuBtn.hideMenu();
			btn.showMenu();
			this.activeMenuBtn=btn;
		}
	},
	onButtonMenuShow:function(btn){
		this.activeMenuBtn=btn;
	},
	onButtonMenuHide:function(btn){
		delete this.activeMenuBtn;
	}});
Ext.reg('toolbar',Ext.Toolbar);
T.Item=Ext.extend(Ext.BoxComponent,{
	hideParent:true,
	enable:Ext.emptyFn,
	disable:Ext.emptyFn,
	focus:Ext.emptyFn
	});
Ext.reg('tbitem',T.Item);
T.Separator=Ext.extend(T.Item,{
	onRender:function(ct,position){
		this.el=ct.createChild({tag:'span',cls:'xtb-sep'},position);
	}});
Ext.reg('tbseparator',T.Separator);
T.Spacer=Ext.extend(T.Item,{
	onRender:function(ct,position){
		this.el=ct.createChild({tag:'div',cls:'xtb-spacer',style:this.width?'width:'+this.width+'px':''},position);
	}});
Ext.reg('tbspacer',T.Spacer);
T.Fill=Ext.extend(T.Item,{
	render:Ext.emptyFn,
	isFill:true});
Ext.reg('tbfill',T.Fill);
T.TextItem=Ext.extend(T.Item,{
	constructor:function(config){
		if(Ext.isString(config)){
			config={autoEl:{cls:'xtb-text',html:config}};
		}else{
			config.autoEl={cls:'xtb-text',html:config.text||''};
		}
		T.TextItem.superclass.constructor.call(this,config);
	},
	setText:function(t){
		if(this.rendered){
			this.el.dom.innerHTML=t;
		}else{
			this.autoEl.html=t;
		}
	}});
Ext.reg('tbtext',T.TextItem);
T.Button=Ext.extend(Ext.Button,{});
T.SplitButton=Ext.extend(Ext.SplitButton,{});
Ext.reg('tbbutton',T.Button);
Ext.reg('tbsplit',T.SplitButton);})();
Ext.ButtonGroup=Ext.extend(Ext.Panel,{
	baseCls:'x-btn-group',
	layout:'table',
	defaultType:'button',
	frame:true,
	internalDefaults:{removeMode:'container',hideParent:true},
	initComponent:function(){
		this.layoutConfig=this.layoutConfig||{};
		Ext.applyIf(this.layoutConfig,{
			columns:this.columns
		});
		if(!this.title){
			this.addClass('x-btn-group-notitle');
		}
		this.on('afterlayout',this.onAfterLayout,this);
		Ext.ButtonGroup.superclass.initComponent.call(this);
	},
	applyDefaults:function(c){
		c=Ext.ButtonGroup.superclass.applyDefaults.call(this,c);
		var d=this.internalDefaults;
		if(c.events){
			Ext.applyIf(c.initialConfig,d);
			Ext.apply(c,d);
		}else{
			Ext.applyIf(c,d);
		}
		return c;
	},
	onAfterLayout:function(){
		var bodyWidth=this.body.getFrameWidth('lr')+this.body.dom.firstChild.offsetWidth;
		this.body.setWidth(bodyWidth);
		this.el.setWidth(bodyWidth+this.getFrameWidth());
	}
	});
Ext.reg('buttongroup',Ext.ButtonGroup);
(function(){
var T=Ext.Toolbar;
Ext.PagingToolbar=Ext.extend(Ext.Toolbar,{
	pageSize:20,
	displayMsg:'Displaying {0} - {1} of {2}',
	emptyMsg:'No data to display',
	beforePageText:'Page',
	afterPageText:'of {0}',
	firstText:'First Page',
	prevText:'Previous Page',
	nextText:'Next Page',
	lastText:'Last Page',
	refreshText:'Refresh',
	initComponent:function(){
		var pagingItems=[this.first=new T.Button({
			tooltip:this.firstText,
			overflowText:this.firstText,
			iconCls:'x-tbar-page-first',
			disabled:true,
			handler:this.moveFirst,
			scope:this
		}),this.prev=new T.Button({
			tooltip:this.prevText,
			overflowText:this.prevText,
			iconCls:'x-tbar-page-prev',
			disabled:true,
			handler:this.movePrevious,
			scope:this
		}),'-',this.beforePageText,
		this.inputItem=new Ext.form.NumberField({
			cls:'x-tbar-page-number',
			allowDecimals:false,
			allowNegative:false,
			enableKeyEvents:true,
			selectOnFocus:true,
			listeners:{
				scope:this,
				keydown:this.onPagingKeyDown,
				blur:this.onPagingBlur
			}
		}),this.afterTextItem=new T.TextItem({
			text:String.format(this.afterPageText,1)
		}),'-',this.next=new T.Button({
			tooltip:this.nextText,
			overflowText:this.nextText,
			iconCls:'x-tbar-page-next',
			disabled:true,
			handler:this.moveNext,
			scope:this
		}),this.last=new T.Button({
			tooltip:this.lastText,
			overflowText:this.lastText,
			iconCls:'x-tbar-page-last',
			disabled:true,
			handler:this.moveLast,
			scope:this
		}),'-',this.refresh=new T.Button({
			tooltip:this.refreshText,
			overflowText:this.refreshText,
			iconCls:'x-tbar-loading',
			handler:this.refresh,
			scope:this
		})];
		var userItems=this.items||this.buttons||[];
		if(this.prependButtons){
			this.items=userItems.concat(pagingItems);
		}else{
			this.items=pagingItems.concat(userItems);
		}
		delete this.buttons;
		if(this.displayInfo){
			this.items.push('->');
			this.items.push(this.displayItem=new T.TextItem({}));
		}
		Ext.PagingToolbar.superclass.initComponent.call(this);
		this.addEvents(
			'change',
			'beforechange'
		);
		this.on('afterlayout',this.onFirstLayout,this,{single:true});
		this.cursor=0;
		this.bindStore(this.store);
	},
	onFirstLayout:function(){
		if(this.dsLoaded){
			this.onLoad.apply(this,this.dsLoaded);
		}
	},
	updateInfo:function(){
		if(this.displayItem){
			var count=this.store.getCount();
			var msg=count==0?
				this.emptyMsg:
				String.format(
					this.displayMsg,
					this.cursor+1,this.cursor+count,this.store.getTotalCount()
				);
			this.displayItem.setText(msg);
		}
	},
	onLoad:function(store,r,o){
		if(!this.rendered){
			this.dsLoaded=[store,r,o];
			return;
		}
		var p=this.getParams();
		this.cursor=(o.params&&o.params[p.start])?o.params[p.start]:0;
		var d=this.getPageData(),ap=d.activePage,ps=d.pages;
		this.afterTextItem.setText(String.format(this.afterPageText,d.pages));
		this.inputItem.setValue(ap);
		this.first.setDisabled(ap==1);
		this.prev.setDisabled(ap==1);
		this.next.setDisabled(ap==ps);
		this.last.setDisabled(ap==ps);
		this.refresh.enable();
		this.updateInfo();
		this.fireEvent('change',this,d);
	},
	getPageData:function(){
		var total=this.store.getTotalCount();
		return{
			total:total,
			activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),
			pages:total<this.pageSize?1:Math.ceil(total/this.pageSize)
		};
	},
	changePage:function(page){
		this.doLoad(((page-1)*this.pageSize).constrain(0,this.store.getTotalCount()));
	},
	onLoadError:function(){
		if(!this.rendered){
			return;
		}
		this.refresh.enable();
	},
	readPage:function(d){
		var v=this.inputItem.getValue(),pageNum;
		if(!v||isNaN(pageNum=parseInt(v,10))){
			this.inputItem.setValue(d.activePage);
			return false;
		}
		return pageNum;
	},
	onPagingFocus:function(){
		this.inputItem.select();
	},
	onPagingBlur:function(e){
		this.inputItem.setValue(this.getPageData().activePage);
	},
	onPagingKeyDown:function(field,e){
		var k=e.getKey(),d=this.getPageData(),pageNum;
		if(k==e.RETURN){
			e.stopEvent();
			pageNum=this.readPage(d);
			if(pageNum!==false){
				pageNum=Math.min(Math.max(1,pageNum),d.pages)-1;
				this.doLoad(pageNum*this.pageSize);
			}
		}else if(k==e.HOME||k==e.END){
			e.stopEvent();
			pageNum=k==e.HOME?1:d.pages;
			field.setValue(pageNum);
		}else if(k==e.UP||k==e.PAGEUP||k==e.DOWN||k==e.PAGEDOWN){
			e.stopEvent();
			if((pageNum=this.readPage(d))){
				var increment=e.shiftKey?10:1;
				if(k==e.DOWN||k==e.PAGEDOWN){
					increment*=-1;
				}
				pageNum+=increment;
				if(pageNum>=1&pageNum<=d.pages){
					field.setValue(pageNum);
				}
			}
		}
	},
	getParams:function(){
		return this.paramNames||this.store.paramNames;
	},
	beforeLoad:function(){
		if(this.rendered&&this.refresh){
			this.refresh.disable();
		}
	},
	doLoad:function(start){
		var o={},pn=this.getParams();
		o[pn.start]=start;
		o[pn.limit]=this.pageSize;
		if(this.fireEvent('beforechange',this,o)!==false){
			this.store.load({params:o});
		}
	},
	moveFirst:function(){
		this.doLoad(0);
	},
	movePrevious:function(){
		this.doLoad(Math.max(0,this.cursor-this.pageSize));
	},
	moveNext:function(){
		this.doLoad(this.cursor+this.pageSize);
	},
	moveLast:function(){
		var total=this.store.getTotalCount(),
			extra=total%this.pageSize;
		this.doLoad(extra?(total-extra):total-this.pageSize);
	},
	refresh:function(){
		this.doLoad(this.cursor);
	},
	bindStore:function(store,initial){
		var doLoad;
		if(!initial&&this.store){
			this.store.un('beforeload',this.beforeLoad,this);
			this.store.un('load',this.onLoad,this);
			this.store.un('exception',this.onLoadError,this);
			if(store!==this.store&&this.store.autoDestroy){
				this.store.destroy();
			}
		}
		if(store){
			store=Ext.StoreMgr.lookup(store);
			store.on({
				scope:this,
				beforeload:this.beforeLoad,
				load:this.onLoad,
				exception:this.onLoadError
			});
			doLoad=store.getCount()>0;
		}
		this.store=store;
		if(doLoad){
			this.onLoad(store,null,{});
		}
	},
	unbind:function(store){
		this.bindStore(null);
	},
	bind:function(store){
		this.bindStore(store);
	},
	onDestroy:function(){
		this.bindStore(null);
		Ext.PagingToolbar.superclass.onDestroy.call(this);
	}});})();
Ext.reg('paging',Ext.PagingToolbar);
Ext.History=(function(){
	var iframe,hiddenField;
	var ready=false;
	var currentToken;
	function getHash(){
		var href=top.location.href,i=href.indexOf("#");
		return i>=0?href.substr(i+1):null;
	}
	function doSave(){
		hiddenField.value=currentToken;
	}
	function handleStateChange(token){
		currentToken=token;
		Ext.History.fireEvent('change',token);
	}
	function updateIFrame(token){
		var html=['<html><body><div id="state">',token,'</div></body></html>'].join('');
		try{
			var doc=iframe.contentWindow.document;
			doc.open();
			doc.write(html);
			doc.close();
			return true;
		}catch(e){
			return false;
		}
	}
	function checkIFrame(){
		if(!iframe.contentWindow||!iframe.contentWindow.document){
			setTimeout(checkIFrame,10);
			return;
		}
		var doc=iframe.contentWindow.document;
		var elem=doc.getElementById("state");
		var token=elem?elem.innerText:null;
		var hash=getHash();
		setInterval(function(){
			doc=iframe.contentWindow.document;
			elem=doc.getElementById("state");
			var newtoken=elem?elem.innerText:null;
			var newHash=getHash();
			if(newtoken!==token){
				token=newtoken;
				handleStateChange(token);
				top.location.hash=token;
				hash=token;
				doSave();
			}else if(newHash!==hash){
				hash=newHash;
				updateIFrame(newHash);
			}
		},50);
		ready=true;
		Ext.History.fireEvent('ready',Ext.History);
	}
	function startUp(){
		currentToken=hiddenField.value?hiddenField.value:getHash();
		if(Ext.isIE){
			checkIFrame();
		}else{
			var hash=getHash();
			setInterval(function(){
				var newHash=getHash();
				if(newHash!==hash){
					hash=newHash;
					handleStateChange(hash);
					doSave();
				}
			},50);
			ready=true;
			Ext.History.fireEvent('ready',Ext.History);
		}
	}
	return{
		fieldId:'x-history-field',
		iframeId:'x-history-frame',
		events:{},
		init:function(onReady,scope){
			if(ready){
				Ext.callback(onReady,scope,[this]);
				return;
			}
			if(!Ext.isReady){
				Ext.onReady(function(){
					Ext.History.init(onReady,scope);
				});
				return;
			}
			hiddenField=Ext.getDom(Ext.History.fieldId);
			if(Ext.isIE){
				iframe=Ext.getDom(Ext.History.iframeId);
			}
			this.addEvents('ready','change');
			if(onReady){
				this.on('ready',onReady,scope,{single:true});
			}
			startUp();
		},
		add:function(token,preventDup){
			if(preventDup!==false){
				if(this.getToken()==token){
					return true;
				}
			}
			if(Ext.isIE){
				return updateIFrame(token);
			}else{
				top.location.hash=token;
				return true;
			}
		},
		back:function(){
			history.go(-1);
		},
		forward:function(){
			history.go(1);
		},
		getToken:function(){
			return ready?currentToken:getHash();
		}
	};})();
Ext.apply(Ext.History,new Ext.util.Observable());
Ext.Tip=Ext.extend(Ext.Panel,{
	minWidth:40,
	maxWidth:300,
	shadow:"sides",
	defaultAlign:"tl-bl?",
	autoRender:true,
	quickShowInterval:250,
	frame:true,
	hidden:true,
	baseCls:'x-tip',
	floating:{shadow:true,shim:true,useDisplay:true,constrain:false},
	autoHeight:true,
	closeAction:'hide',
	initComponent:function(){
		Ext.Tip.superclass.initComponent.call(this);
		if(this.closable&&!this.title){
			this.elements+=',header';
		}
	},
	afterRender:function(){
		Ext.Tip.superclass.afterRender.call(this);
		if(this.closable){
			this.addTool({
				id:'close',
				handler:this[this.closeAction],
				scope:this
			});
		}
	},
	showAt:function(xy){
		Ext.Tip.superclass.show.call(this);
		if(this.measureWidth!==false&&(!this.initialConfig||typeof this.initialConfig.width!='number')){
			this.doAutoWidth();
		}
		if(this.constrainPosition){
			xy=this.el.adjustForConstraints(xy);
		}
		this.setPagePosition(xy[0],xy[1]);
	},
	doAutoWidth:function(){
		var bw=this.body.getTextWidth();
		if(this.title){
			bw=Math.max(bw,this.header.child('span').getTextWidth(this.title));
		}
		bw+=this.getFrameWidth()+(this.closable?20:0)+this.body.getPadding("lr");
		this.setWidth(bw.constrain(this.minWidth,this.maxWidth));
		if(Ext.isIE7&&!this.repainted){
			this.el.repaint();
			this.repainted=true;
		}
	},
	showBy:function(el,pos){
		if(!this.rendered){
			this.render(Ext.getBody());
		}
		this.showAt(this.el.getAlignToXY(el,pos||this.defaultAlign));
	},
	initDraggable:function(){
		this.dd=new Ext.Tip.DD(this,typeof this.draggable=='boolean'?null:this.draggable);
		this.header.addClass('x-tip-draggable');
	}});
Ext.Tip.DD=function(tip,config){
	Ext.apply(this,config);
	this.tip=tip;
	Ext.Tip.DD.superclass.constructor.call(this,tip.el.id,'WindowDD-'+tip.id);
	this.setHandleElId(tip.header.id);
	this.scroll=false;};
Ext.extend(Ext.Tip.DD,Ext.dd.DD,{
	moveOnly:true,
	scroll:false,
	headerOffsets:[100,25],
	startDrag:function(){
		this.tip.el.disableShadow();
	},
	endDrag:function(e){
		this.tip.el.enableShadow(true);
	}});
Ext.ToolTip=Ext.extend(Ext.Tip,{
	showDelay:500,
	hideDelay:200,
	dismissDelay:5000,
	trackMouse:false,
	anchorToTarget:true,
	anchorOffset:0,
	targetCounter:0,
	constrainPosition:false,
	initComponent:function(){
		Ext.ToolTip.superclass.initComponent.call(this);
		this.lastActive=new Date();
		this.initTarget(this.target);
		this.origAnchor=this.anchor;
	},
	onRender:function(ct,position){
		Ext.ToolTip.superclass.onRender.call(this,ct,position);
		this.anchorCls='x-tip-anchor-'+this.getAnchorPosition();
		this.anchorEl=this.el.createChild({
			cls:'x-tip-anchor '+this.anchorCls
		});
	},
	afterRender:function(){
		Ext.ToolTip.superclass.afterRender.call(this);
		this.anchorEl.setStyle('z-index',this.el.getZIndex()+1);
	},
	initTarget:function(target){
		var t;
		if((t=Ext.get(target))){
			if(this.target){
				this.target=Ext.get(this.target);
				this.target.un('mouseover',this.onTargetOver,this);
				this.target.un('mouseout',this.onTargetOut,this);
				this.target.un('mousemove',this.onMouseMove,this);
			}
			this.mon(t,{
				mouseover:this.onTargetOver,
				mouseout:this.onTargetOut,
				mousemove:this.onMouseMove,
				scope:this
			});
			this.target=t;
		}
		if(this.anchor){
			this.anchorTarget=this.target;
		}
	},
	onMouseMove:function(e){
		var t=this.delegate?e.getTarget(this.delegate):this.triggerElement=true;
		if(t){
			this.targetXY=e.getXY();
			if(t===this.triggerElement){
				if(!this.hidden&&this.trackMouse){
					this.setPagePosition(this.getTargetXY());
				}
			}else{
				this.hide();
				this.lastActive=new Date(0);
				this.onTargetOver(e);
			}
		}else if(!this.closable&&this.isVisible()){
			this.hide();
		}
	},
	getTargetXY:function(){
		if(this.anchor){
			this.targetCounter++;
			var offsets=this.getOffsets();
			var xy=(this.anchorToTarget&&!this.trackMouse)?
				this.el.getAlignToXY(this.anchorTarget,this.getAnchorAlign()):
				this.targetXY;
			var dw=Ext.lib.Dom.getViewWidth()-5;
			var dh=Ext.lib.Dom.getViewHeight()-5;
			var scrollX=(document.documentElement.scrollLeft||document.body.scrollLeft||0)+5;
			var scrollY=(document.documentElement.scrollTop||document.body.scrollTop||0)+5;
			var axy=[xy[0]+offsets[0],xy[1]+offsets[1]];
			var sz=this.getSize();
			this.anchorEl.removeClass(this.anchorCls);
			if(this.targetCounter<2){
				if(axy[0]<scrollX){
					if(this.anchorToTarget){
						this.defaultAlign='l-r';
						if(this.mouseOffset){this.mouseOffset[0]*=-1;}
					}
					this.anchor='left';
					return this.getTargetXY();
				}
				if(axy[0]+sz.width>dw){
					if(this.anchorToTarget){
						this.defaultAlign='r-l';
						if(this.mouseOffset){this.mouseOffset[0]*=-1;}
					}
					this.anchor='right';
					return this.getTargetXY();
				}
				if(axy[1]<scrollY){
					if(this.anchorToTarget){
						this.defaultAlign='t-b';
						if(this.mouseOffset){this.mouseOffset[1]*=-1;}
					}
					this.anchor='top';
					return this.getTargetXY();
				}
				if(axy[1]+sz.height>dh){
					if(this.anchorToTarget){
						this.defaultAlign='b-t';
						if(this.mouseOffset){this.mouseOffset[1]*=-1;}
					}
					this.anchor='bottom';
					return this.getTargetXY();
				}
			}
			this.anchorCls='x-tip-anchor-'+this.getAnchorPosition();
			this.anchorEl.addClass(this.anchorCls);
			this.targetCounter=0;
			return axy;
		}else{
			var mouseOffset=this.getMouseOffset();
			return[this.targetXY[0]+mouseOffset[0],this.targetXY[1]+mouseOffset[1]];
		}
	},
	getMouseOffset:function(){
		var offset=this.anchor?[0,0]:[15,18];
		if(this.mouseOffset){
			offset[0]+=this.mouseOffset[0];
			offset[1]+=this.mouseOffset[1];
		}
		return offset;
	},
	getAnchorPosition:function(){
		if(this.anchor){
			this.tipAnchor=this.anchor.charAt(0);
		}else{
			var m=this.defaultAlign.match(/^([a-z]+)-([a-z]+)(\?)?$/);
			if(!m){
			 throw"AnchorTip.defaultAlign is invalid";
			}
			this.tipAnchor=m[1].charAt(0);
		}
		switch(this.tipAnchor){
			case't':return'top';
			case'b':return'bottom';
			case'r':return'right';
		}
		return'left';
	},
	getAnchorAlign:function(){
		switch(this.anchor){
			case'top':return'tl-bl';
			case'left':return'tl-tr';
			case'right':return'tr-tl';
			default	:return'bl-tl';
		}
	},
	getOffsets:function(){
		var offsets,ap=this.getAnchorPosition().charAt(0);
		if(this.anchorToTarget&&!this.trackMouse){
			switch(ap){
				case't':
					offsets=[0,9];
					break;
				case'b':
					offsets=[0,-13];
					break;
				case'r':
					offsets=[-13,0];
					break;
				default:
					offsets=[9,0];
					break;
			}
		}else{
			switch(ap){
				case't':
					offsets=[-15-this.anchorOffset,30];
					break;
				case'b':
					offsets=[-19-this.anchorOffset,-13-this.el.dom.offsetHeight];
					break;
				case'r':
					offsets=[-15-this.el.dom.offsetWidth,-13-this.anchorOffset];
					break;
				default:
					offsets=[25,-13-this.anchorOffset];
					break;
			}
		}
		var mouseOffset=this.getMouseOffset();
		offsets[0]+=mouseOffset[0];
		offsets[1]+=mouseOffset[1];
		return offsets;
	},
	onTargetOver:function(e){
		if(this.disabled||e.within(this.target.dom,true)){
			return;
		}
		var t=e.getTarget(this.delegate);
		if(t){
			this.triggerElement=t;
			this.clearTimer('hide');
			this.targetXY=e.getXY();
			this.delayShow();
		}
	},
	delayShow:function(){
		if(this.hidden&&!this.showTimer){
			if(this.lastActive.getElapsed()<this.quickShowInterval){
				this.show();
			}else{
				this.showTimer=this.show.defer(this.showDelay,this);
			}
		}else if(!this.hidden&&this.autoHide!==false){
			this.show();
		}
	},
	onTargetOut:function(e){
		if(this.disabled||e.within(this.target.dom,true)){
			return;
		}
		this.clearTimer('show');
		if(this.autoHide!==false){
			this.delayHide();
		}
	},
	delayHide:function(){
		if(!this.hidden&&!this.hideTimer){
			this.hideTimer=this.hide.defer(this.hideDelay,this);
		}
	},
	hide:function(){
		this.clearTimer('dismiss');
		this.lastActive=new Date();
		if(this.anchorEl){
			this.anchorEl.hide();
		}
		Ext.ToolTip.superclass.hide.call(this);
		delete this.triggerElement;
	},
	show:function(){
		if(this.anchor){
			this.showAt([-1000,-1000]);
			this.origConstrainPosition=this.constrainPosition;
			this.constrainPosition=false;
			this.anchor=this.origAnchor;
		}
		this.showAt(this.getTargetXY());
		if(this.anchor){
			this.syncAnchor();
			this.anchorEl.show();
			this.constrainPosition=this.origConstrainPosition;
		}else{
			this.anchorEl.hide();
		}
	},
	showAt:function(xy){
		this.lastActive=new Date();
		this.clearTimers();
		Ext.ToolTip.superclass.showAt.call(this,xy);
		if(this.dismissDelay&&this.autoHide!==false){
			this.dismissTimer=this.hide.defer(this.dismissDelay,this);
		}
	},
	syncAnchor:function(){
		var anchorPos,targetPos,offset;
		switch(this.tipAnchor.charAt(0)){
			case't':
				anchorPos='b';
				targetPos='tl';
				offset=[20+this.anchorOffset,2];
				break;
			case'r':
				anchorPos='l';
				targetPos='tr';
				offset=[-2,11+this.anchorOffset];
				break;
			case'b':
				anchorPos='t';
				targetPos='bl';
				offset=[20+this.anchorOffset,-2];
				break;
			default:
				anchorPos='r';
				targetPos='tl';
				offset=[2,11+this.anchorOffset];
				break;
		}
		this.anchorEl.alignTo(this.el,anchorPos+'-'+targetPos,offset);
	},
	setPagePosition:function(x,y){
		Ext.ToolTip.superclass.setPagePosition.call(this,x,y);
		if(this.anchor){
			this.syncAnchor();
		}
	},
	clearTimer:function(name){
		name=name+'Timer';
		clearTimeout(this[name]);
		delete this[name];
	},
	clearTimers:function(){
		this.clearTimer('show');
		this.clearTimer('dismiss');
		this.clearTimer('hide');
	},
	onShow:function(){
		Ext.ToolTip.superclass.onShow.call(this);
		Ext.getDoc().on('mousedown',this.onDocMouseDown,this);
	},
	onHide:function(){
		Ext.ToolTip.superclass.onHide.call(this);
		Ext.getDoc().un('mousedown',this.onDocMouseDown,this);
	},
	onDocMouseDown:function(e){
		if(this.autoHide!==true&&!this.closable&&!e.within(this.el.dom)){
			this.disable();
			this.enable.defer(100,this);
		}
	},
	onDisable:function(){
		this.clearTimers();
		this.hide();
	},
	adjustPosition:function(x,y){
		if(this.contstrainPosition){
			var ay=this.targetXY[1],h=this.getSize().height;
			if(y<=ay&&(y+h)>=ay){
				y=ay-h-5;
			}
		}
		return{x:x,y:y};
	},
	onDestroy:function(){
		Ext.getDoc().un('mousedown',this.onDocMouseDown,this);
		Ext.ToolTip.superclass.onDestroy.call(this);
	}});
Ext.QuickTip=Ext.extend(Ext.ToolTip,{
	interceptTitles:false,
	tagConfig:{
		namespace:"ext",
		attribute:"qtip",
		width:"qwidth",
		target:"target",
		title:"qtitle",
		hide:"hide",
		cls:"qclass",
		align:"qalign",
		anchor:"anchor"
	},
	initComponent:function(){
		this.target=this.target||Ext.getDoc();
		this.targets=this.targets||{};
		Ext.QuickTip.superclass.initComponent.call(this);
	},
	register:function(config){
		var cs=Ext.isArray(config)?config:arguments;
		for(var i=0,len=cs.length;i<len;i++){
			var c=cs[i];
			var target=c.target;
			if(target){
				if(Ext.isArray(target)){
					for(var j=0,jlen=target.length;j<jlen;j++){
						this.targets[Ext.id(target[j])]=c;
					}
				}else{
					this.targets[Ext.id(target)]=c;
				}
			}
		}
	},
	unregister:function(el){
		delete this.targets[Ext.id(el)];
	},
	cancelShow:function(el){
		var at=this.activeTarget;
		el=Ext.get(el).dom;
		if(this.isVisible()){
			if(at&&at.el==el){
				this.hide();
			}
		}else if(at&&at.el==el){
			this.clearTimer('show');
		}
	},
	onTargetOver:function(e){
		if(this.disabled){
			return;
		}
		this.targetXY=e.getXY();
		var t=e.getTarget();
		if(!t||t.nodeType!==1||t==document||t==document.body){
			return;
		}
		if(this.activeTarget&&t==this.activeTarget.el){
			this.clearTimer('hide');
			this.show();
			return;
		}
		if(t&&this.targets[t.id]){
			this.activeTarget=this.targets[t.id];
			this.activeTarget.el=t;
			this.anchor=this.activeTarget.anchor;
			if(this.anchor){
				this.anchorTarget=t;
			}
			this.delayShow();
			return;
		}
		var ttp,et=Ext.fly(t),cfg=this.tagConfig;
		var ns=cfg.namespace;
		if(this.interceptTitles&&t.title){
			ttp=t.title;
			t.qtip=ttp;
			t.removeAttribute("title");
			e.preventDefault();
		}else{
			ttp=t.qtip||et.getAttribute(cfg.attribute,ns);
		}
		if(ttp){
			var autoHide=et.getAttribute(cfg.hide,ns);
			this.activeTarget={
				el:t,
				text:ttp,
				width:et.getAttribute(cfg.width,ns),
				autoHide:autoHide!="user"&&autoHide!=='false',
				title:et.getAttribute(cfg.title,ns),
				cls:et.getAttribute(cfg.cls,ns),
				align:et.getAttribute(cfg.align,ns)
			};
			this.anchor=et.getAttribute(cfg.anchor,ns);
			if(this.anchor){
				this.anchorTarget=t;
			}
			this.delayShow();
		}
	},
	onTargetOut:function(e){
		this.clearTimer('show');
		if(this.autoHide!==false){
			this.delayHide();
		}
	},
	showAt:function(xy){
		var t=this.activeTarget;
		if(t){
			if(!this.rendered){
				this.render(Ext.getBody());
				this.activeTarget=t;
			}
			if(t.width){
				this.setWidth(t.width);
				this.body.setWidth(this.adjustBodyWidth(t.width-this.getFrameWidth()));
				this.measureWidth=false;
			}else{
				this.measureWidth=true;
			}
			this.setTitle(t.title||'');
			this.body.update(t.text);
			this.autoHide=t.autoHide;
			this.dismissDelay=t.dismissDelay||this.dismissDelay;
			if(this.lastCls){
				this.el.removeClass(this.lastCls);
				delete this.lastCls;
			}
			if(t.cls){
				this.el.addClass(t.cls);
				this.lastCls=t.cls;
			}
			if(this.anchor){
				this.constrainPosition=false;
			}else if(t.align){
				xy=this.el.getAlignToXY(t.el,t.align);
				this.constrainPosition=false;
			}else{
				this.constrainPosition=true;
			}
		}
		Ext.QuickTip.superclass.showAt.call(this,xy);
	},
	hide:function(){
		delete this.activeTarget;
		Ext.QuickTip.superclass.hide.call(this);
	}});
Ext.QuickTips=function(){
	var tip,locks=[];
	return{
		init:function(autoRender){
			if(!tip){
				if(!Ext.isReady){
					Ext.onReady(function(){
						Ext.QuickTips.init(autoRender);
					});
					return;
				}
				tip=new Ext.QuickTip({elements:'header,body'});
				if(autoRender!==false){
					tip.render(Ext.getBody());
				}
			}
		},
		enable:function(){
			if(tip){
				locks.pop();
				if(locks.length<1){
					tip.enable();
				}
			}
		},
		disable:function(){
			if(tip){
				tip.disable();
			}
			locks.push(1);
		},
		isEnabled:function(){
			return tip!==undefined&&!tip.disabled;
		},
		getQuickTip:function(){
			return tip;
		},
		register:function(){
			tip.register.apply(tip,arguments);
		},
		unregister:function(){
			tip.unregister.apply(tip,arguments);
		},
		tips:function(){
			tip.register.apply(tip,arguments);
		}
	}}();
Ext.tree.TreePanel=Ext.extend(Ext.Panel,{
	rootVisible:true,
	animate:Ext.enableFx,
	lines:true,
	enableDD:false,
	hlDrop:Ext.enableFx,
	pathSeparator:"/",
	initComponent:function(){
		Ext.tree.TreePanel.superclass.initComponent.call(this);
		if(!this.eventModel){
			this.eventModel=new Ext.tree.TreeEventModel(this);
		}
		var l=this.loader;
		if(!l){
			l=new Ext.tree.TreeLoader({
				dataUrl:this.dataUrl,
				requestMethod:this.requestMethod
			});
		}else if(typeof l=='object'&&!l.load){
			l=new Ext.tree.TreeLoader(l);
		}
		this.loader=l;
		this.nodeHash={};
		if(this.root){
			var r=this.root;
			delete this.root;
			this.setRootNode(r);
		}
		this.addEvents(
		"append",
		"remove",
		"movenode",
		"insert",
		"beforeappend",
		"beforeremove",
		"beforemovenode",
			"beforeinsert",
			"beforeload",
			"load",
			"textchange",
			"beforeexpandnode",
			"beforecollapsenode",
			"expandnode",
			"disabledchange",
			"collapsenode",
			"beforeclick",
			"click",
			"checkchange",
			"dblclick",
			"contextmenu",
			"beforechildrenrendered",
			"startdrag",
			"enddrag",
			"dragdrop",
			"beforenodedrop",
			"nodedrop",
			"nodedragover"
		);
		if(this.singleExpand){
			this.on("beforeexpandnode",this.restrictExpand,this);
		}
	},
	proxyNodeEvent:function(ename,a1,a2,a3,a4,a5,a6){
		if(ename=='collapse'||ename=='expand'||ename=='beforecollapse'||ename=='beforeexpand'||ename=='move'||ename=='beforemove'){
			ename=ename+'node';
		}
		return this.fireEvent(ename,a1,a2,a3,a4,a5,a6);
	},
	getRootNode:function(){
		return this.root;
	},
	setRootNode:function(node){
		Ext.destroy(this.root);
		if(!node.render){
			node=this.loader.createNode(node);
		}
		this.root=node;
		node.ownerTree=this;
		node.isRoot=true;
		this.registerNode(node);
		if(!this.rootVisible){
			var uiP=node.attributes.uiProvider;
			node.ui=uiP?new uiP(node):new Ext.tree.RootTreeNodeUI(node);
		}
		if(this.innerCt){
			this.innerCt.update('');
			this.afterRender();
		}
		return node;
	},
	getNodeById:function(id){
		return this.nodeHash[id];
	},
	registerNode:function(node){
		this.nodeHash[node.id]=node;
	},
	unregisterNode:function(node){
		delete this.nodeHash[node.id];
	},
	toString:function(){
		return"[Tree"+(this.id?" "+this.id:"")+"]";
	},
	restrictExpand:function(node){
		var p=node.parentNode;
		if(p){
			if(p.expandedChild&&p.expandedChild.parentNode==p){
				p.expandedChild.collapse();
			}
			p.expandedChild=node;
		}
	},
	getChecked:function(a,startNode){
		startNode=startNode||this.root;
		var r=[];
		var f=function(){
			if(this.attributes.checked){
				r.push(!a?this:(a=='id'?this.id:this.attributes[a]));
			}
		};
		startNode.cascade(f);
		return r;
	},
	getEl:function(){
		return this.el;
	},
	getLoader:function(){
		return this.loader;
	},
	expandAll:function(){
		this.root.expand(true);
	},
	collapseAll:function(){
		this.root.collapse(true);
	},
	getSelectionModel:function(){
		if(!this.selModel){
			this.selModel=new Ext.tree.DefaultSelectionModel();
		}
		return this.selModel;
	},
	expandPath:function(path,attr,callback){
		attr=attr||"id";
		var keys=path.split(this.pathSeparator);
		var curNode=this.root;
		if(curNode.attributes[attr]!=keys[1]){
			if(callback){
				callback(false,null);
			}
			return;
		}
		var index=1;
		var f=function(){
			if(++index==keys.length){
				if(callback){
					callback(true,curNode);
				}
				return;
			}
			var c=curNode.findChild(attr,keys[index]);
			if(!c){
				if(callback){
					callback(false,curNode);
				}
				return;
			}
			curNode=c;
			c.expand(false,false,f);
		};
		curNode.expand(false,false,f);
	},
	selectPath:function(path,attr,callback){
		attr=attr||"id";
		var keys=path.split(this.pathSeparator);
		var v=keys.pop();
		if(keys.length>0){
			var f=function(success,node){
				if(success&&node){
					var n=node.findChild(attr,v);
					if(n){
						n.select();
						if(callback){
							callback(true,n);
						}
					}else if(callback){
						callback(false,n);
					}
				}else{
					if(callback){
						callback(false,n);
					}
				}
			};
			this.expandPath(keys.join(this.pathSeparator),attr,f);
		}else{
			this.root.select();
			if(callback){
				callback(true,this.root);
			}
		}
	},
	getTreeEl:function(){
		return this.body;
	},
	onRender:function(ct,position){
		Ext.tree.TreePanel.superclass.onRender.call(this,ct,position);
		this.el.addClass('x-tree');
		this.innerCt=this.body.createChild({tag:"ul",
			 cls:"x-tree-root-ct "+
			(this.useArrows?'x-tree-arrows':this.lines?"x-tree-lines":"x-tree-no-lines")});
	},
	initEvents:function(){
		Ext.tree.TreePanel.superclass.initEvents.call(this);
		if(this.containerScroll){
			Ext.dd.ScrollManager.register(this.body);
		}
		if((this.enableDD||this.enableDrop)&&!this.dropZone){
			 this.dropZone=new Ext.tree.TreeDropZone(this,this.dropConfig||{
			 ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true
		});
		}
		if((this.enableDD||this.enableDrag)&&!this.dragZone){
			this.dragZone=new Ext.tree.TreeDragZone(this,this.dragConfig||{
			 ddGroup:this.ddGroup||"TreeDD",
			 scroll:this.ddScroll
		});
		}
		this.getSelectionModel().init(this);
	},
	afterRender:function(){
		Ext.tree.TreePanel.superclass.afterRender.call(this);
		this.root.render();
		if(!this.rootVisible){
			this.root.renderChildren();
		}
	},
	onDestroy:function(){
		if(this.rendered){
			this.body.removeAllListeners();
			Ext.dd.ScrollManager.unregister(this.body);
			if(this.dropZone){
				this.dropZone.unreg();
			}
			if(this.dragZone){
			 this.dragZone.unreg();
			}
		}
		this.root.destroy();
		this.nodeHash=null;
		Ext.tree.TreePanel.superclass.onDestroy.call(this);
	}
	});
Ext.tree.TreePanel.nodeTypes={};
Ext.reg('treepanel',Ext.tree.TreePanel);Ext.tree.TreeEventModel=function(tree){
	this.tree=tree;
	this.tree.on('render',this.initEvents,this);}
Ext.tree.TreeEventModel.prototype={
	initEvents:function(){
		var el=this.tree.getTreeEl();
		el.on('click',this.delegateClick,this);
		if(this.tree.trackMouseOver!==false){
			this.tree.innerCt.on('mouseover',this.delegateOver,this);
			this.tree.innerCt.on('mouseout',this.delegateOut,this);
		}
		el.on('dblclick',this.delegateDblClick,this);
		el.on('contextmenu',this.delegateContextMenu,this);
	},
	getNode:function(e){
		var t;
		if(t=e.getTarget('.x-tree-node-el',10)){
			var id=Ext.fly(t,'_treeEvents').getAttribute('tree-node-id','ext');
			if(id){
				return this.tree.getNodeById(id);
			}
		}
		return null;
	},
	getNodeTarget:function(e){
		var t=e.getTarget('.x-tree-node-icon',1);
		if(!t){
			t=e.getTarget('.x-tree-node-el',6);
		}
		return t;
	},
	delegateOut:function(e,t){
		if(!this.beforeEvent(e)){
			return;
		}
		if(e.getTarget('.x-tree-ec-icon',1)){
			var n=this.getNode(e);
			this.onIconOut(e,n);
			if(n==this.lastEcOver){
				delete this.lastEcOver;
			}
		}
		if((t=this.getNodeTarget(e))&&!e.within(t,true)){
			this.onNodeOut(e,this.getNode(e));
		}
	},
	delegateOver:function(e,t){
		if(!this.beforeEvent(e)){
			return;
		}
		if(Ext.isGecko&&!this.trackingDoc){
			Ext.getBody().on('mouseover',this.trackExit,this);
			this.trackingDoc=true;
		}
		if(this.lastEcOver){
			this.onIconOut(e,this.lastEcOver);
			delete this.lastEcOver;
		}
		if(e.getTarget('.x-tree-ec-icon',1)){
			this.lastEcOver=this.getNode(e);
			this.onIconOver(e,this.lastEcOver);
		}
		if(t=this.getNodeTarget(e)){
			this.onNodeOver(e,this.getNode(e));
		}
	},
	trackExit:function(e){
		if(this.lastOverNode&&!e.within(this.lastOverNode.ui.getEl())){
			this.onNodeOut(e,this.lastOverNode);
			delete this.lastOverNode;
			Ext.getBody().un('mouseover',this.trackExit,this);
			this.trackingDoc=false;
		}
	},
	delegateClick:function(e,t){
		if(!this.beforeEvent(e)){
			return;
		}
		if(e.getTarget('input[type=checkbox]',1)){
			this.onCheckboxClick(e,this.getNode(e));
		}
		else if(e.getTarget('.x-tree-ec-icon',1)){
			this.onIconClick(e,this.getNode(e));
		}
		else if(this.getNodeTarget(e)){
			this.onNodeClick(e,this.getNode(e));
		}
	},
	delegateDblClick:function(e,t){
		if(this.beforeEvent(e)&&this.getNodeTarget(e)){
			this.onNodeDblClick(e,this.getNode(e));
		}
	},
	delegateContextMenu:function(e,t){
		if(this.beforeEvent(e)&&this.getNodeTarget(e)){
			this.onNodeContextMenu(e,this.getNode(e));
		}
	},
	onNodeClick:function(e,node){
		node.ui.onClick(e);
	},
	onNodeOver:function(e,node){
		this.lastOverNode=node;
		node.ui.onOver(e);
	},
	onNodeOut:function(e,node){
		node.ui.onOut(e);
	},
	onIconOver:function(e,node){
		node.ui.addClass('x-tree-ec-over');
	},
	onIconOut:function(e,node){
		node.ui.removeClass('x-tree-ec-over');
	},
	onIconClick:function(e,node){
		node.ui.ecClick(e);
	},
	onCheckboxClick:function(e,node){
		node.ui.onCheckChange(e);
	},
	onNodeDblClick:function(e,node){
		node.ui.onDblClick(e);
	},
	onNodeContextMenu:function(e,node){
		node.ui.onContextMenu(e);
	},
	beforeEvent:function(e){
		if(this.disabled){
			e.stopEvent();
			return false;
		}
		return true;
	},
	disable:function(){
		this.disabled=true;
	},
	enable:function(){
		this.disabled=false;
	}};
Ext.tree.DefaultSelectionModel=function(config){
this.selNode=null;
this.addEvents(
	"selectionchange",
	"beforeselect");
	Ext.apply(this,config);
	Ext.tree.DefaultSelectionModel.superclass.constructor.call(this);};
Ext.extend(Ext.tree.DefaultSelectionModel,Ext.util.Observable,{
	init:function(tree){
		this.tree=tree;
		tree.getTreeEl().on("keydown",this.onKeyDown,this);
		tree.on("click",this.onNodeClick,this);
	},
	onNodeClick:function(node,e){
		this.select(node);
	},
	select:function(node){
		var last=this.selNode;
		if(node==last){
			node.ui.onSelectedChange(true);
		}else if(this.fireEvent('beforeselect',this,node,last)!==false){
			if(last){
				last.ui.onSelectedChange(false);
			}
			this.selNode=node;
			node.ui.onSelectedChange(true);
			this.fireEvent("selectionchange",this,node,last);
		}
		return node;
	},
	unselect:function(node){
		if(this.selNode==node){
			this.clearSelections();
		}
	},
	clearSelections:function(){
		var n=this.selNode;
		if(n){
			n.ui.onSelectedChange(false);
			this.selNode=null;
			this.fireEvent("selectionchange",this,null);
		}
		return n;
	},
	getSelectedNode:function(){
		return this.selNode;
	},
	isSelected:function(node){
		return this.selNode==node;
	},
	selectPrevious:function(){
		var s=this.selNode||this.lastSelNode;
		if(!s){
			return null;
		}
		var ps=s.previousSibling;
		if(ps){
			if(!ps.isExpanded()||ps.childNodes.length<1){
				return this.select(ps);
			}else{
				var lc=ps.lastChild;
				while(lc&&lc.isExpanded()&&lc.childNodes.length>0){
					lc=lc.lastChild;
				}
				return this.select(lc);
			}
		}else if(s.parentNode&&(this.tree.rootVisible||!s.parentNode.isRoot)){
			return this.select(s.parentNode);
		}
		return null;
	},
	selectNext:function(){
		var s=this.selNode||this.lastSelNode;
		if(!s){
			return null;
		}
		if(s.firstChild&&s.isExpanded()){
			 return this.select(s.firstChild);
		}else if(s.nextSibling){
			 return this.select(s.nextSibling);
		}else if(s.parentNode){
			var newS=null;
			s.parentNode.bubble(function(){
				if(this.nextSibling){
					newS=this.getOwnerTree().selModel.select(this.nextSibling);
					return false;
				}
			});
			return newS;
		}
		return null;
	},
	onKeyDown:function(e){
		var s=this.selNode||this.lastSelNode;
		var sm=this;
		if(!s){
			return;
		}
		var k=e.getKey();
		switch(k){
			 case e.DOWN:
				 e.stopEvent();
				 this.selectNext();
			 break;
			 case e.UP:
				 e.stopEvent();
				 this.selectPrevious();
			 break;
			 case e.RIGHT:
				 e.preventDefault();
				 if(s.hasChildNodes()){
					 if(!s.isExpanded()){
						 s.expand();
					}else if(s.firstChild){
						 this.select(s.firstChild,e);
					}
				}
			 break;
			 case e.LEFT:
				 e.preventDefault();
				 if(s.hasChildNodes()&&s.isExpanded()){
					 s.collapse();
				}else if(s.parentNode&&(this.tree.rootVisible||s.parentNode!=this.tree.getRootNode())){
					 this.select(s.parentNode,e);
				}
			 break;
		};
	}});
Ext.tree.MultiSelectionModel=function(config){
this.selNodes=[];
this.selMap={};
this.addEvents(
	"selectionchange");
	Ext.apply(this,config);
	Ext.tree.MultiSelectionModel.superclass.constructor.call(this);};
Ext.extend(Ext.tree.MultiSelectionModel,Ext.util.Observable,{
	init:function(tree){
		this.tree=tree;
		tree.getTreeEl().on("keydown",this.onKeyDown,this);
		tree.on("click",this.onNodeClick,this);
	},
	onNodeClick:function(node,e){
		if(e.ctrlKey&&this.isSelected(node)){
			this.unselect(node);
		}else{
			this.select(node,e,e.ctrlKey);
		}
	},
	select:function(node,e,keepExisting){
		if(keepExisting!==true){
			this.clearSelections(true);
		}
		if(this.isSelected(node)){
			this.lastSelNode=node;
			return node;
		}
		this.selNodes.push(node);
		this.selMap[node.id]=node;
		this.lastSelNode=node;
		node.ui.onSelectedChange(true);
		this.fireEvent("selectionchange",this,this.selNodes);
		return node;
	},
	unselect:function(node){
		if(this.selMap[node.id]){
			node.ui.onSelectedChange(false);
			var sn=this.selNodes;
			var index=sn.indexOf(node);
			if(index!=-1){
				this.selNodes.splice(index,1);
			}
			delete this.selMap[node.id];
			this.fireEvent("selectionchange",this,this.selNodes);
		}
	},
	clearSelections:function(suppressEvent){
		var sn=this.selNodes;
		if(sn.length>0){
			for(var i=0,len=sn.length;i<len;i++){
				sn[i].ui.onSelectedChange(false);
			}
			this.selNodes=[];
			this.selMap={};
			if(suppressEvent!==true){
				this.fireEvent("selectionchange",this,this.selNodes);
			}
		}
	},
	isSelected:function(node){
		return this.selMap[node.id]?true:false;
	},
	getSelectedNodes:function(){
		return this.selNodes;
	},
	onKeyDown:Ext.tree.DefaultSelectionModel.prototype.onKeyDown,
	selectNext:Ext.tree.DefaultSelectionModel.prototype.selectNext,
	selectPrevious:Ext.tree.DefaultSelectionModel.prototype.selectPrevious});
Ext.data.Tree=function(root){
this.nodeHash={};
this.root=null;
if(root){
	 this.setRootNode(root);}
this.addEvents(
	"append",
	"remove",
	"move",
	"insert",
	"beforeappend",
	"beforeremove",
	"beforemove",
	"beforeinsert");
	Ext.data.Tree.superclass.constructor.call(this);};
Ext.extend(Ext.data.Tree,Ext.util.Observable,{
	pathSeparator:"/",
	proxyNodeEvent:function(){
		return this.fireEvent.apply(this,arguments);
	},
	getRootNode:function(){
		return this.root;
	},
	setRootNode:function(node){
		this.root=node;
		node.ownerTree=this;
		node.isRoot=true;
		this.registerNode(node);
		return node;
	},
	getNodeById:function(id){
		return this.nodeHash[id];
	},
	registerNode:function(node){
		this.nodeHash[node.id]=node;
	},
	unregisterNode:function(node){
		delete this.nodeHash[node.id];
	},
	toString:function(){
		return"[Tree"+(this.id?" "+this.id:"")+"]";
	}});
Ext.data.Node=function(attributes){
	this.attributes=attributes||{};
	this.leaf=this.attributes.leaf;
	this.id=this.attributes.id;
	if(!this.id){
		this.id=Ext.id(null,"xnode-");
		this.attributes.id=this.id;
	}
	this.childNodes=[];
	if(!this.childNodes.indexOf){
		this.childNodes.indexOf=function(o){
			for(var i=0,len=this.length;i<len;i++){
				if(this[i]==o){
					return i;
				}
			}
			return-1;
		};
	}
	this.parentNode=null;
	this.firstChild=null;
	this.lastChild=null;
	this.previousSibling=null;
	this.nextSibling=null;
	this.addEvents({
	"append":true,
	"remove":true,
	"move":true,
	"insert":true,
	"beforeappend":true,
	"beforeremove":true,
	"beforemove":true,
	"beforeinsert":true});
	this.listeners=this.attributes.listeners;
	Ext.data.Node.superclass.constructor.call(this);};
Ext.extend(Ext.data.Node,Ext.util.Observable,{
	fireEvent:function(evtName){
		if(Ext.data.Node.superclass.fireEvent.apply(this,arguments)===false){
			return false;
		}
		var ot=this.getOwnerTree();
		if(ot){
			if(ot.proxyNodeEvent.apply(ot,arguments)===false){
				return false;
			}
		}
		return true;
	},
	isLeaf:function(){
		return this.leaf===true;
	},
	setFirstChild:function(node){
		this.firstChild=node;
	},
	setLastChild:function(node){
		this.lastChild=node;
	},
	isLast:function(){
	 return(!this.parentNode?true:this.parentNode.lastChild==this);
	},
	isFirst:function(){
	 return(!this.parentNode?true:this.parentNode.firstChild==this);
	},
	hasChildNodes:function(){
		return!this.isLeaf()&&this.childNodes.length>0;
	},
	isExpandable:function(){
		return this.attributes.expandable||this.hasChildNodes();
	},
	appendChild:function(node){
		var multi=false;
		if(Ext.isArray(node)){
			multi=node;
		}else if(arguments.length>1){
			multi=arguments;
		}
		if(multi){
			for(var i=0,len=multi.length;i<len;i++){
				this.appendChild(multi[i]);
			}
		}else{
			if(this.fireEvent("beforeappend",this.ownerTree,this,node)===false){
				return false;
			}
			var index=this.childNodes.length;
			var oldParent=node.parentNode;
			if(oldParent){
				if(node.fireEvent("beforemove",node.getOwnerTree(),node,oldParent,this,index)===false){
					return false;
				}
				oldParent.removeChild(node);
			}
			index=this.childNodes.length;
			if(index===0){
				this.setFirstChild(node);
			}
			this.childNodes.push(node);
			node.parentNode=this;
			var ps=this.childNodes[index-1];
			if(ps){
				node.previousSibling=ps;
				ps.nextSibling=node;
			}else{
				node.previousSibling=null;
			}
			node.nextSibling=null;
			this.setLastChild(node);
			node.setOwnerTree(this.getOwnerTree());
			this.fireEvent("append",this.ownerTree,this,node,index);
			if(oldParent){
				node.fireEvent("move",this.ownerTree,node,oldParent,this,index);
			}
			return node;
		}
	},
	removeChild:function(node){
		var index=this.childNodes.indexOf(node);
		if(index==-1){
			return false;
		}
		if(this.fireEvent("beforeremove",this.ownerTree,this,node)===false){
			return false;
		}
		this.childNodes.splice(index,1);
		if(node.previousSibling){
			node.previousSibling.nextSibling=node.nextSibling;
		}
		if(node.nextSibling){
			node.nextSibling.previousSibling=node.previousSibling;
		}
		if(this.firstChild==node){
			this.setFirstChild(node.nextSibling);
		}
		if(this.lastChild==node){
			this.setLastChild(node.previousSibling);
		}
		node.setOwnerTree(null);
		node.parentNode=null;
		node.previousSibling=null;
		node.nextSibling=null;
		this.fireEvent("remove",this.ownerTree,this,node);
		return node;
	},
	insertBefore:function(node,refNode){
		if(!refNode){
			return this.appendChild(node);
		}
		if(node==refNode){
			return false;
		}
		if(this.fireEvent("beforeinsert",this.ownerTree,this,node,refNode)===false){
			return false;
		}
		var index=this.childNodes.indexOf(refNode);
		var oldParent=node.parentNode;
		var refIndex=index;
		if(oldParent==this&&this.childNodes.indexOf(node)<index){
			refIndex--;
		}
		if(oldParent){
			if(node.fireEvent("beforemove",node.getOwnerTree(),node,oldParent,this,index,refNode)===false){
				return false;
			}
			oldParent.removeChild(node);
		}
		if(refIndex===0){
			this.setFirstChild(node);
		}
		this.childNodes.splice(refIndex,0,node);
		node.parentNode=this;
		var ps=this.childNodes[refIndex-1];
		if(ps){
			node.previousSibling=ps;
			ps.nextSibling=node;
		}else{
			node.previousSibling=null;
		}
		node.nextSibling=refNode;
		refNode.previousSibling=node;
		node.setOwnerTree(this.getOwnerTree());
		this.fireEvent("insert",this.ownerTree,this,node,refNode);
		if(oldParent){
			node.fireEvent("move",this.ownerTree,node,oldParent,this,refIndex,refNode);
		}
		return node;
	},
	remove:function(){
		this.parentNode.removeChild(this);
		return this;
	},
	item:function(index){
		return this.childNodes[index];
	},
	replaceChild:function(newChild,oldChild){
		var s=oldChild?oldChild.nextSibling:null;
		this.removeChild(oldChild);
		this.insertBefore(newChild,s);
		return oldChild;
	},
	indexOf:function(child){
		return this.childNodes.indexOf(child);
	},
	getOwnerTree:function(){
		if(!this.ownerTree){
			var p=this;
			while(p){
				if(p.ownerTree){
					this.ownerTree=p.ownerTree;
					break;
				}
				p=p.parentNode;
			}
		}
		return this.ownerTree;
	},
	getDepth:function(){
		var depth=0;
		var p=this;
		while(p.parentNode){
			++depth;
			p=p.parentNode;
		}
		return depth;
	},
	setOwnerTree:function(tree){
		if(tree!=this.ownerTree){
			if(this.ownerTree){
				this.ownerTree.unregisterNode(this);
			}
			this.ownerTree=tree;
			var cs=this.childNodes;
			for(var i=0,len=cs.length;i<len;i++){
				cs[i].setOwnerTree(tree);
			}
			if(tree){
				tree.registerNode(this);
			}
		}
	},
	setId:function(id){
		if(id!==this.id){
			var t=this.ownerTree;
			if(t){
				t.unregisterNode(this);
			}
			this.id=id;
			if(t){
				t.registerNode(this);
			}
			this.onIdChange(id);
		}
	},
	onIdChange:Ext.emptyFn,
	getPath:function(attr){
		attr=attr||"id";
		var p=this.parentNode;
		var b=[this.attributes[attr]];
		while(p){
			b.unshift(p.attributes[attr]);
			p=p.parentNode;
		}
		var sep=this.getOwnerTree().pathSeparator;
		return sep+b.join(sep);
	},
	bubble:function(fn,scope,args){
		var p=this;
		while(p){
			if(fn.apply(scope||p,args||[p])===false){
				break;
			}
			p=p.parentNode;
		}
	},
	cascade:function(fn,scope,args){
		if(fn.apply(scope||this,args||[this])!==false){
			var cs=this.childNodes;
			for(var i=0,len=cs.length;i<len;i++){
				cs[i].cascade(fn,scope,args);
			}
		}
	},
	eachChild:function(fn,scope,args){
		var cs=this.childNodes;
		for(var i=0,len=cs.length;i<len;i++){
			if(fn.apply(scope||this,args||[cs[i]])===false){
				break;
			}
		}
	},
	findChild:function(attribute,value){
		var cs=this.childNodes;
		for(var i=0,len=cs.length;i<len;i++){
			if(cs[i].attributes[attribute]==value){
				return cs[i];
			}
		}
		return null;
	},
	findChildBy:function(fn,scope){
		var cs=this.childNodes;
		for(var i=0,len=cs.length;i<len;i++){
			if(fn.call(scope||cs[i],cs[i])===true){
				return cs[i];
			}
		}
		return null;
	},
	sort:function(fn,scope){
		var cs=this.childNodes;
		var len=cs.length;
		if(len>0){
			var sortFn=scope?function(){fn.apply(scope,arguments);}:fn;
			cs.sort(sortFn);
			for(var i=0;i<len;i++){
				var n=cs[i];
				n.previousSibling=cs[i-1];
				n.nextSibling=cs[i+1];
				if(i===0){
					this.setFirstChild(n);
				}
				if(i==len-1){
					this.setLastChild(n);
				}
			}
		}
	},
	contains:function(node){
		return node.isAncestor(this);
	},
	isAncestor:function(node){
		var p=this.parentNode;
		while(p){
			if(p==node){
				return true;
			}
			p=p.parentNode;
		}
		return false;
	},
	toString:function(){
		return"[Node"+(this.id?" "+this.id:"")+"]";
	}});
Ext.tree.TreeNode=function(attributes){
	attributes=attributes||{};
	if(typeof attributes=="string"){
		attributes={text:attributes};
	}
	this.childrenRendered=false;
	this.rendered=false;
	Ext.tree.TreeNode.superclass.constructor.call(this,attributes);
	this.expanded=attributes.expanded===true;
	this.isTarget=attributes.isTarget!==false;
	this.draggable=attributes.draggable!==false&&attributes.allowDrag!==false;
	this.allowChildren=attributes.allowChildren!==false&&attributes.allowDrop!==false;
	this.text=attributes.text;
	this.disabled=attributes.disabled===true;
	this.hidden=attributes.hidden===true;
	this.addEvents(
		"textchange",
		"beforeexpand",
		"beforecollapse",
		"expand",
		"disabledchange",
		"collapse",
		"beforeclick",
		"click",
		"checkchange",
		"dblclick",
		"contextmenu",
		"beforechildrenrendered"
	);
	var uiClass=this.attributes.uiProvider||this.defaultUI||Ext.tree.TreeNodeUI;
	this.ui=new uiClass(this);};
Ext.extend(Ext.tree.TreeNode,Ext.data.Node,{
	preventHScroll:true,
	isExpanded:function(){
		return this.expanded;
	},
	getUI:function(){
		return this.ui;
	},
	getLoader:function(){
		var owner;
		return this.loader||((owner=this.getOwnerTree())&&owner.loader?owner.loader:new Ext.tree.TreeLoader());
	},
	setFirstChild:function(node){
		var of=this.firstChild;
		Ext.tree.TreeNode.superclass.setFirstChild.call(this,node);
		if(this.childrenRendered&&of&&node!=of){
			of.renderIndent(true,true);
		}
		if(this.rendered){
			this.renderIndent(true,true);
		}
	},
	setLastChild:function(node){
		var ol=this.lastChild;
		Ext.tree.TreeNode.superclass.setLastChild.call(this,node);
		if(this.childrenRendered&&ol&&node!=ol){
			ol.renderIndent(true,true);
		}
		if(this.rendered){
			this.renderIndent(true,true);
		}
	},
	appendChild:function(n){
		if(!n.render&&!Ext.isArray(n)){
			n=this.getLoader().createNode(n);
		}
		var node=Ext.tree.TreeNode.superclass.appendChild.call(this,n);
		if(node&&this.childrenRendered){
			node.render();
		}
		this.ui.updateExpandIcon();
		return node;
	},
	removeChild:function(node){
		this.ownerTree.getSelectionModel().unselect(node);
		Ext.tree.TreeNode.superclass.removeChild.apply(this,arguments);
		if(this.childrenRendered){
			node.ui.remove();
		}
		if(this.childNodes.length<1){
			this.collapse(false,false);
		}else{
			this.ui.updateExpandIcon();
		}
		if(!this.firstChild&&!this.isHiddenRoot()){
			this.childrenRendered=false;
		}
		return node;
	},
	insertBefore:function(node,refNode){
		if(!node.render){
			node=this.getLoader().createNode(node);
		}
		var newNode=Ext.tree.TreeNode.superclass.insertBefore.call(this,node,refNode);
		if(newNode&&refNode&&this.childrenRendered){
			node.render();
		}
		this.ui.updateExpandIcon();
		return newNode;
	},
	setText:function(text){
		var oldText=this.text;
		this.text=text;
		this.attributes.text=text;
		if(this.rendered){
			this.ui.onTextChange(this,text,oldText);
		}
		this.fireEvent("textchange",this,text,oldText);
	},
	select:function(){
		this.getOwnerTree().getSelectionModel().select(this);
	},
	unselect:function(){
		this.getOwnerTree().getSelectionModel().unselect(this);
	},
	isSelected:function(){
		return this.getOwnerTree().getSelectionModel().isSelected(this);
	},
	expand:function(deep,anim,callback,scope){
		if(!this.expanded){
			if(this.fireEvent("beforeexpand",this,deep,anim)===false){
				return;
			}
			if(!this.childrenRendered){
				this.renderChildren();
			}
			this.expanded=true;
			if(!this.isHiddenRoot()&&(this.getOwnerTree().animate&&anim!==false)||anim){
				this.ui.animExpand(function(){
					this.fireEvent("expand",this);
					this.runCallback(callback,scope||this,[this]);
					if(deep===true){
						this.expandChildNodes(true);
					}
				}.createDelegate(this));
				return;
			}else{
				this.ui.expand();
				this.fireEvent("expand",this);
				this.runCallback(callback,scope||this,[this]);
			}
		}else{
		 this.runCallback(callback,scope||this,[this]);
		}
		if(deep===true){
			this.expandChildNodes(true);
		}
	},
	runCallback:function(cb,scope,args){
		if(Ext.isFunction(cb)){
			cb.apply(scope,args);
		}
	},
	isHiddenRoot:function(){
		return this.isRoot&&!this.getOwnerTree().rootVisible;
	},
	collapse:function(deep,anim,callback,scope){
		if(this.expanded&&!this.isHiddenRoot()){
			if(this.fireEvent("beforecollapse",this,deep,anim)===false){
				return;
			}
			this.expanded=false;
			if((this.getOwnerTree().animate&&anim!==false)||anim){
				this.ui.animCollapse(function(){
					this.fireEvent("collapse",this);
					this.runCallback(callback,scope||this,[this]);
					if(deep===true){
						this.collapseChildNodes(true);
					}
				}.createDelegate(this));
				return;
			}else{
				this.ui.collapse();
				this.fireEvent("collapse",this);
				this.runCallback(callback,scope||this,[this]);
			}
		}else if(!this.expanded){
			this.runCallback(callback,scope||this,[this]);
		}
		if(deep===true){
			var cs=this.childNodes;
			for(var i=0,len=cs.length;i<len;i++){
				cs[i].collapse(true,false);
			}
		}
	},
	delayedExpand:function(delay){
		if(!this.expandProcId){
			this.expandProcId=this.expand.defer(delay,this);
		}
	},
	cancelExpand:function(){
		if(this.expandProcId){
			clearTimeout(this.expandProcId);
		}
		this.expandProcId=false;
	},
	toggle:function(){
		if(this.expanded){
			this.collapse();
		}else{
			this.expand();
		}
	},
	ensureVisible:function(callback,scope){
		var tree=this.getOwnerTree();
		tree.expandPath(this.parentNode?this.parentNode.getPath():this.getPath(),false,function(){
			var node=tree.getNodeById(this.id);
			tree.getTreeEl().scrollChildIntoView(node.ui.anchor);
			this.runCallback(callback,scope||this,[this]);
		}.createDelegate(this));
	},
	expandChildNodes:function(deep){
		var cs=this.childNodes;
		for(var i=0,len=cs.length;i<len;i++){
			cs[i].expand(deep);
		}
	},
	collapseChildNodes:function(deep){
		var cs=this.childNodes;
		for(var i=0,len=cs.length;i<len;i++){
			cs[i].collapse(deep);
		}
	},
	disable:function(){
		this.disabled=true;
		this.unselect();
		if(this.rendered&&this.ui.onDisableChange){
			this.ui.onDisableChange(this,true);
		}
		this.fireEvent("disabledchange",this,true);
	},
	enable:function(){
		this.disabled=false;
		if(this.rendered&&this.ui.onDisableChange){
			this.ui.onDisableChange(this,false);
		}
		this.fireEvent("disabledchange",this,false);
	},
	renderChildren:function(suppressEvent){
		if(suppressEvent!==false){
			this.fireEvent("beforechildrenrendered",this);
		}
		var cs=this.childNodes;
		for(var i=0,len=cs.length;i<len;i++){
			cs[i].render(true);
		}
		this.childrenRendered=true;
	},
	sort:function(fn,scope){
		Ext.tree.TreeNode.superclass.sort.apply(this,arguments);
		if(this.childrenRendered){
			var cs=this.childNodes;
			for(var i=0,len=cs.length;i<len;i++){
				cs[i].render(true);
			}
		}
	},
	render:function(bulkRender){
		this.ui.render(bulkRender);
		if(!this.rendered){
			this.getOwnerTree().registerNode(this);
			this.rendered=true;
			if(this.expanded){
				this.expanded=false;
				this.expand(false,false);
			}
		}
	},
	renderIndent:function(deep,refresh){
		if(refresh){
			this.ui.childIndent=null;
		}
		this.ui.renderIndent();
		if(deep===true&&this.childrenRendered){
			var cs=this.childNodes;
			for(var i=0,len=cs.length;i<len;i++){
				cs[i].renderIndent(true,refresh);
			}
		}
	},
	beginUpdate:function(){
		this.childrenRendered=false;
	},
	endUpdate:function(){
		if(this.expanded&&this.rendered){
			this.renderChildren();
		}
	},
	destroy:function(){
		if(this.childNodes){
			for(var i=0,l=this.childNodes.length;i<l;i++){
				this.childNodes[i].destroy();
			}
			this.childNodes=null;
		}
		if(this.ui.destroy){
			this.ui.destroy();
		}
	},
	onIdChange:function(id){
		this.ui.onIdChange(id);
	}});
Ext.tree.TreePanel.nodeTypes.node=Ext.tree.TreeNode;
Ext.tree.AsyncTreeNode=function(config){
	this.loaded=config&&config.loaded===true;
	this.loading=false;
	Ext.tree.AsyncTreeNode.superclass.constructor.apply(this,arguments);
	this.addEvents('beforeload','load');
	};
Ext.extend(Ext.tree.AsyncTreeNode,Ext.tree.TreeNode,{
	expand:function(deep,anim,callback,scope){
		if(this.loading){
			var timer;
			var f=function(){
				if(!this.loading){
					clearInterval(timer);
					this.expand(deep,anim,callback,scope);
				}
			}.createDelegate(this);
			timer=setInterval(f,200);
			return;
		}
		if(!this.loaded){
			if(this.fireEvent("beforeload",this)===false){
				return;
			}
			this.loading=true;
			this.ui.beforeLoad(this);
			var loader=this.loader||this.attributes.loader||this.getOwnerTree().getLoader();
			if(loader){
				loader.load(this,this.loadComplete.createDelegate(this,[deep,anim,callback,scope]),this);
				return;
			}
		}
		Ext.tree.AsyncTreeNode.superclass.expand.call(this,deep,anim,callback,scope);
	},
	isLoading:function(){
		return this.loading;
	},
	loadComplete:function(deep,anim,callback,scope){
		this.loading=false;
		this.loaded=true;
		this.ui.afterLoad(this);
		this.fireEvent("load",this);
		this.expand(deep,anim,callback,scope);
	},
	isLoaded:function(){
		return this.loaded;
	},
	hasChildNodes:function(){
		if(!this.isLeaf()&&!this.loaded){
			return true;
		}else{
			return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);
		}
	},
	reload:function(callback,scope){
		this.collapse(false,false);
		while(this.firstChild){
			this.removeChild(this.firstChild).destroy();
		}
		this.childrenRendered=false;
		this.loaded=false;
		if(this.isHiddenRoot()){
			this.expanded=false;
		}
		this.expand(false,false,callback,scope);
	}});
Ext.tree.TreePanel.nodeTypes.async=Ext.tree.AsyncTreeNode;
Ext.tree.TreeNodeUI=function(node){
	this.node=node;
	this.rendered=false;
	this.animating=false;
	this.wasLeaf=true;
	this.ecc='x-tree-ec-icon x-tree-elbow';
	this.emptyIcon=Ext.BLANK_IMAGE_URL;};
Ext.tree.TreeNodeUI.prototype={
	removeChild:function(node){
		if(this.rendered){
			this.ctNode.removeChild(node.ui.getEl());
		}
	},
	beforeLoad:function(){
		 this.addClass("x-tree-node-loading");
	},
	afterLoad:function(){
		 this.removeClass("x-tree-node-loading");
	},
	onTextChange:function(node,text,oldText){
		if(this.rendered){
			this.textNode.innerHTML=text;
		}
	},
	onDisableChange:function(node,state){
		this.disabled=state;
		if(this.checkbox){
			this.checkbox.disabled=state;
		}
		if(state){
			this.addClass("x-tree-node-disabled");
		}else{
			this.removeClass("x-tree-node-disabled");
		}
	},
	onSelectedChange:function(state){
		if(state){
			this.focus();
			this.addClass("x-tree-selected");
		}else{
			this.removeClass("x-tree-selected");
		}
	},
	onMove:function(tree,node,oldParent,newParent,index,refNode){
		this.childIndent=null;
		if(this.rendered){
			var targetNode=newParent.ui.getContainer();
			if(!targetNode){
				this.holder=document.createElement("div");
				this.holder.appendChild(this.wrap);
				return;
			}
			var insertBefore=refNode?refNode.ui.getEl():null;
			if(insertBefore){
				targetNode.insertBefore(this.wrap,insertBefore);
			}else{
				targetNode.appendChild(this.wrap);
			}
			this.node.renderIndent(true,oldParent!=newParent);
		}
	},
	addClass:function(cls){
		if(this.elNode){
			Ext.fly(this.elNode).addClass(cls);
		}
	},
	removeClass:function(cls){
		if(this.elNode){
			Ext.fly(this.elNode).removeClass(cls);
		}
	},
	remove:function(){
		if(this.rendered){
			this.holder=document.createElement("div");
			this.holder.appendChild(this.wrap);
		}
	},
	fireEvent:function(){
		return this.node.fireEvent.apply(this.node,arguments);
	},
	initEvents:function(){
		this.node.on("move",this.onMove,this);
		if(this.node.disabled){
			this.addClass("x-tree-node-disabled");
			if(this.checkbox){
				this.checkbox.disabled=true;
			}
		}
		if(this.node.hidden){
			this.hide();
		}
		var ot=this.node.getOwnerTree();
		var dd=ot.enableDD||ot.enableDrag||ot.enableDrop;
		if(dd&&(!this.node.isRoot||ot.rootVisible)){
			Ext.dd.Registry.register(this.elNode,{
				node:this.node,
				handles:this.getDDHandles(),
				isHandle:false
			});
		}
	},
	getDDHandles:function(){
		return[this.iconNode,this.textNode,this.elNode];
	},
	hide:function(){
		this.node.hidden=true;
		if(this.wrap){
			this.wrap.style.display="none";
		}
	},
	show:function(){
		this.node.hidden=false;
		if(this.wrap){
			this.wrap.style.display="";
		}
	},
	onContextMenu:function(e){
		if(this.node.hasListener("contextmenu")||this.node.getOwnerTree().hasListener("contextmenu")){
			e.preventDefault();
			this.focus();
			this.fireEvent("contextmenu",this.node,e);
		}
	},
	onClick:function(e){
		if(this.dropping){
			e.stopEvent();
			return;
		}
		if(this.fireEvent("beforeclick",this.node,e)!==false){
			var a=e.getTarget('a');
			if(!this.disabled&&this.node.attributes.href&&a){
				this.fireEvent("click",this.node,e);
				return;
			}else if(a&&e.ctrlKey){
				e.stopEvent();
			}
			e.preventDefault();
			if(this.disabled){
				return;
			}
			if(this.node.attributes.singleClickExpand&&!this.animating&&this.node.isExpandable()){
				this.node.toggle();
			}
			this.fireEvent("click",this.node,e);
		}else{
			e.stopEvent();
		}
	},
	onDblClick:function(e){
		e.preventDefault();
		if(this.disabled){
			return;
		}
		if(this.checkbox){
			this.toggleCheck();
		}
		if(!this.animating&&this.node.isExpandable()){
			this.node.toggle();
		}
		this.fireEvent("dblclick",this.node,e);
	},
	onOver:function(e){
		this.addClass('x-tree-node-over');
	},
	onOut:function(e){
		this.removeClass('x-tree-node-over');
	},
	onCheckChange:function(){
		var checked=this.checkbox.checked;
		this.checkbox.defaultChecked=checked;
		this.node.attributes.checked=checked;
		this.fireEvent('checkchange',this.node,checked);
	},
	ecClick:function(e){
		if(!this.animating&&this.node.isExpandable()){
			this.node.toggle();
		}
	},
	startDrop:function(){
		this.dropping=true;
	},
	endDrop:function(){
	 setTimeout(function(){
		 this.dropping=false;
	}.createDelegate(this),50);
	},
	expand:function(){
		this.updateExpandIcon();
		this.ctNode.style.display="";
	},
	focus:function(){
		if(!this.node.preventHScroll){
			try{this.anchor.focus();
			}catch(e){}
		}else{
			try{
				var noscroll=this.node.getOwnerTree().getTreeEl().dom;
				var l=noscroll.scrollLeft;
				this.anchor.focus();
				noscroll.scrollLeft=l;
			}catch(e){}
		}
	},
	toggleCheck:function(value){
		var cb=this.checkbox;
		if(cb){
			cb.checked=(value===undefined?!cb.checked:value);
			this.onCheckChange();
		}
	},
	blur:function(){
		try{
			this.anchor.blur();
		}catch(e){}
	},
	animExpand:function(callback){
		var ct=Ext.get(this.ctNode);
		ct.stopFx();
		if(!this.node.isExpandable()){
			this.updateExpandIcon();
			this.ctNode.style.display="";
			Ext.callback(callback);
			return;
		}
		this.animating=true;
		this.updateExpandIcon();
		ct.slideIn('t',{
		 callback:function(){
			 this.animating=false;
			 Ext.callback(callback);
			},
			scope:this,
			duration:this.node.ownerTree.duration||.25
		});
	},
	highlight:function(){
		var tree=this.node.getOwnerTree();
		Ext.fly(this.wrap).highlight(
			tree.hlColor||"C3DAF9",
			{endColor:tree.hlBaseColor}
		);
	},
	collapse:function(){
		this.updateExpandIcon();
		this.ctNode.style.display="none";
	},
	animCollapse:function(callback){
		var ct=Ext.get(this.ctNode);
		ct.enableDisplayMode('block');
		ct.stopFx();
		this.animating=true;
		this.updateExpandIcon();
		ct.slideOut('t',{
			callback:function(){
			 this.animating=false;
			 Ext.callback(callback);
			},
			scope:this,
			duration:this.node.ownerTree.duration||.25
		});
	},
	getContainer:function(){
		return this.ctNode;
	},
	getEl:function(){
		return this.wrap;
	},
	appendDDGhost:function(ghostNode){
		ghostNode.appendChild(this.elNode.cloneNode(true));
	},
	getDDRepairXY:function(){
		return Ext.lib.Dom.getXY(this.iconNode);
	},
	onRender:function(){
		this.render();
	},
	render:function(bulkRender){
		var n=this.node,a=n.attributes;
		var targetNode=n.parentNode?
			 n.parentNode.ui.getContainer():n.ownerTree.innerCt.dom;
		if(!this.rendered){
			this.rendered=true;
			this.renderElements(n,a,targetNode,bulkRender);
			if(a.qtip){
			 if(this.textNode.setAttributeNS){
				 this.textNode.setAttributeNS("ext","qtip",a.qtip);
				 if(a.qtipTitle){
					 this.textNode.setAttributeNS("ext","qtitle",a.qtipTitle);
				}
			}else{
				 this.textNode.setAttribute("ext:qtip",a.qtip);
				 if(a.qtipTitle){
					 this.textNode.setAttribute("ext:qtitle",a.qtipTitle);
				}
			}
			}else if(a.qtipCfg){
				a.qtipCfg.target=Ext.id(this.textNode);
				Ext.QuickTips.register(a.qtipCfg);
			}
			this.initEvents();
			if(!this.node.expanded){
				this.updateExpandIcon(true);
			}
		}else{
			if(bulkRender===true){
				targetNode.appendChild(this.wrap);
			}
		}
	},
	renderElements:function(n,a,targetNode,bulkRender){
		this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';
		var cb=typeof a.checked=='boolean';
		var href=a.href?a.href:Ext.isGecko?"":"#";
		var buf=['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ',a.cls,'" unselectable="on">',
			'<span class="x-tree-node-indent">',this.indentMarkup,"</span>",
			'<img src="',this.emptyIcon,'" class="x-tree-ec-icon x-tree-elbow" />',
			'<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),'" unselectable="on" />',
			cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':'/>')):'',
			'<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',
			 a.hrefTarget?' target="'+a.hrefTarget+'"':"",'><span unselectable="on">',n.text,"</span></a></div>",
			'<ul class="x-tree-node-ct" style="display:none;"></ul>',
			"</li>"].join('');
		var nel;
		if(bulkRender!==true&&n.nextSibling&&(nel=n.nextSibling.ui.getEl())){
			this.wrap=Ext.DomHelper.insertHtml("beforeBegin",nel,buf);
		}else{
			this.wrap=Ext.DomHelper.insertHtml("beforeEnd",targetNode,buf);
		}
		this.elNode=this.wrap.childNodes[0];
		this.ctNode=this.wrap.childNodes[1];
		var cs=this.elNode.childNodes;
		this.indentNode=cs[0];
		this.ecNode=cs[1];
		this.iconNode=cs[2];
		var index=3;
		if(cb){
			this.checkbox=cs[3];
			this.checkbox.defaultChecked=this.checkbox.checked;
			index++;
		}
		this.anchor=cs[index];
		this.textNode=cs[index].firstChild;
	},
	getAnchor:function(){
		return this.anchor;
	},
	getTextEl:function(){
		return this.textNode;
	},
	getIconEl:function(){
		return this.iconNode;
	},
	isChecked:function(){
		return this.checkbox?this.checkbox.checked:false;
	},
	updateExpandIcon:function(){
		if(this.rendered){
			var n=this.node,c1,c2;
			var cls=n.isLast()?"x-tree-elbow-end":"x-tree-elbow";
			var hasChild=n.hasChildNodes();
			if(hasChild||n.attributes.expandable){
				if(n.expanded){
					cls+="-minus";
					c1="x-tree-node-collapsed";
					c2="x-tree-node-expanded";
				}else{
					cls+="-plus";
					c1="x-tree-node-expanded";
					c2="x-tree-node-collapsed";
				}
				if(this.wasLeaf){
					this.removeClass("x-tree-node-leaf");
					this.wasLeaf=false;
				}
				if(this.c1!=c1||this.c2!=c2){
					Ext.fly(this.elNode).replaceClass(c1,c2);
					this.c1=c1;this.c2=c2;
				}
			}else{
				if(!this.wasLeaf){
					Ext.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");
					delete this.c1;
					delete this.c2;
					this.wasLeaf=true;
				}
			}
			var ecc="x-tree-ec-icon "+cls;
			if(this.ecc!=ecc){
				this.ecNode.className=ecc;
				this.ecc=ecc;
			}
		}
	},
	onIdChange:function(id){
		if(this.rendered){
			this.elNode.setAttribute('ext:tree-node-id',id);
		}
	},
	getChildIndent:function(){
		if(!this.childIndent){
			var buf=[];
			var p=this.node;
			while(p){
				if(!p.isRoot||(p.isRoot&&p.ownerTree.rootVisible)){
					if(!p.isLast()){
						buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');
					}else{
						buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');
					}
				}
				p=p.parentNode;
			}
			this.childIndent=buf.join("");
		}
		return this.childIndent;
	},
	renderIndent:function(){
		if(this.rendered){
			var indent="";
			var p=this.node.parentNode;
			if(p){
				indent=p.ui.getChildIndent();
			}
			if(this.indentMarkup!=indent){
				this.indentNode.innerHTML=indent;
				this.indentMarkup=indent;
			}
			this.updateExpandIcon();
		}
	},
	destroy:function(){
		if(this.elNode){
			Ext.dd.Registry.unregister(this.elNode.id);
		}
		delete this.elNode;
		delete this.ctNode;
		delete this.indentNode;
		delete this.ecNode;
		delete this.iconNode;
		delete this.checkbox;
		delete this.anchor;
		delete this.textNode;
		if(this.holder){
			 delete this.wrap;
			 Ext.removeNode(this.holder);
			 delete this.holder;
		}else{
			Ext.removeNode(this.wrap);
			delete this.wrap;
		}
	}};
Ext.tree.RootTreeNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{
	render:function(){
		if(!this.rendered){
			var targetNode=this.node.ownerTree.innerCt.dom;
			this.node.expanded=true;
			targetNode.innerHTML='<div class="x-tree-root-node"></div>';
			this.wrap=this.ctNode=targetNode.firstChild;
		}
	},
	collapse:Ext.emptyFn,
	expand:Ext.emptyFn});
Ext.tree.TreeLoader=function(config){
	this.baseParams={};
	Ext.apply(this,config);
	this.addEvents(
		"beforeload",
		"load",
		"loadexception"
	);
	Ext.tree.TreeLoader.superclass.constructor.call(this);
	if(typeof this.paramOrder=='string'){
		this.paramOrder=this.paramOrder.split(/[\s,|]/);
	}};
Ext.extend(Ext.tree.TreeLoader,Ext.util.Observable,{
	uiProviders:{},
	clearOnLoad:true,
	paramOrder:undefined,
	paramsAsHash:false,
	directFn:undefined,
	load:function(node,callback,scope){
		if(this.clearOnLoad){
			while(node.firstChild){
				node.removeChild(node.firstChild);
			}
		}
		if(this.doPreload(node)){
			this.runCallback(callback,scope||node,[]);
		}else if(this.directFn||this.dataUrl||this.url){
			this.requestData(node,callback,scope||node);
		}
	},
	doPreload:function(node){
		if(node.attributes.children){
			if(node.childNodes.length<1){
				var cs=node.attributes.children;
				node.beginUpdate();
				for(var i=0,len=cs.length;i<len;i++){
					var cn=node.appendChild(this.createNode(cs[i]));
					if(this.preloadChildren){
						this.doPreload(cn);
					}
				}
				node.endUpdate();
			}
			return true;
		}
		return false;
	},
	getParams:function(node){
		var buf=[],bp=this.baseParams;
		if(this.directFn){
			buf.push(node.id);
			if(bp){
				if(this.paramOrder){
					for(var i=0,len=this.paramOrder.length;i<len;i++){
						buf.push(bp[this.paramOrder[i]]);
					}
				}else if(this.paramsAsHash){
					buf.push(bp);
				}
			}
			return buf;
		}else{
			for(var key in bp){
				if(!Ext.isFunction(bp[key])){
					buf.push(encodeURIComponent(key),"=",encodeURIComponent(bp[key]),"&");
				}
			}
			buf.push("node=",encodeURIComponent(node.id));
			return buf.join("");
		}
	},
	requestData:function(node,callback,scope){
		if(this.fireEvent("beforeload",this,node,callback)!==false){
			if(this.directFn){
				var args=this.getParams(node);
				args.push(this.processDirectResponse.createDelegate(this,[{callback:callback,node:node,scope:scope}],true));
				this.directFn.apply(window,args);
			}else{
				this.transId=Ext.Ajax.request({
					method:this.requestMethod,
					url:this.dataUrl||this.url,
					success:this.handleResponse,
					failure:this.handleFailure,
					scope:this,
					argument:{callback:callback,node:node,scope:scope},
					params:this.getParams(node)
				});
			}
		}else{
			this.runCallback(callback,scope||node,[]);
		}
	},
	processDirectResponse:function(result,response,args){
		if(response.status){
			this.handleResponse({
				responseData:Ext.isArray(result)?result:null,
				responseText:result,
				argument:args
			});
		}else{
			this.handleFailure({
				argument:args
			});
		}
	},
	runCallback:function(cb,scope,args){
		if(Ext.isFunction(cb)){
			cb.apply(scope,args);
		}
	},
	isLoading:function(){
		return!!this.transId;
	},
	abort:function(){
		if(this.isLoading()){
			Ext.Ajax.abort(this.transId);
		}
	},
	createNode:function(attr){
		if(this.baseAttrs){
			Ext.applyIf(attr,this.baseAttrs);
		}
		if(this.applyLoader!==false){
			attr.loader=this;
		}
		if(typeof attr.uiProvider=='string'){
		 attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);
		}
		if(attr.nodeType){
			return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);
		}else{
			return attr.leaf?
						new Ext.tree.TreeNode(attr):
						new Ext.tree.AsyncTreeNode(attr);
		}
	},
	processResponse:function(response,node,callback,scope){
		var json=response.responseText;
		try{
			var o=response.responseData||Ext.decode(json);
			node.beginUpdate();
			for(var i=0,len=o.length;i<len;i++){
				var n=this.createNode(o[i]);
				if(n){
					node.appendChild(n);
				}
			}
			node.endUpdate();
			this.runCallback(callback,scope||node,[node]);
		}catch(e){
			this.handleFailure(response);
		}
	},
	handleResponse:function(response){
		this.transId=false;
		var a=response.argument;
		this.processResponse(response,a.node,a.callback,a.scope);
		this.fireEvent("load",this,a.node,response);
	},
	handleFailure:function(response){
		this.transId=false;
		var a=response.argument;
		this.fireEvent("loadexception",this,a.node,response);
		this.runCallback(a.callback,a.scope||a.node,[a.node]);
	}});
Ext.tree.TreeFilter=function(tree,config){
	this.tree=tree;
	this.filtered={};
	Ext.apply(this,config);};
Ext.tree.TreeFilter.prototype={
	clearBlank:false,
	reverse:false,
	autoClear:false,
	remove:false,
	filter:function(value,attr,startNode){
		attr=attr||"text";
		var f;
		if(typeof value=="string"){
			var vlen=value.length;
			if(vlen==0&&this.clearBlank){
				this.clear();
				return;
			}
			value=value.toLowerCase();
			f=function(n){
				return n.attributes[attr].substr(0,vlen).toLowerCase()==value;
			};
		}else if(value.exec){
			f=function(n){
				return value.test(n.attributes[attr]);
			};
		}else{
			throw'Illegal filter type, must be string or regex';
		}
		this.filterBy(f,null,startNode);
	},
	filterBy:function(fn,scope,startNode){
		startNode=startNode||this.tree.root;
		if(this.autoClear){
			this.clear();
		}
		var af=this.filtered,rv=this.reverse;
		var f=function(n){
			if(n==startNode){
				return true;
			}
			if(af[n.id]){
				return false;
			}
			var m=fn.call(scope||n,n);
			if(!m||rv){
				af[n.id]=n;
				n.ui.hide();
				return false;
			}
			return true;
		};
		startNode.cascade(f);
		if(this.remove){
		 for(var id in af){
			 if(typeof id!="function"){
				 var n=af[id];
				 if(n&&n.parentNode){
					 n.parentNode.removeChild(n);
				}
			}
		}
		}
	},
	clear:function(){
		var t=this.tree;
		var af=this.filtered;
		for(var id in af){
			if(typeof id!="function"){
				var n=af[id];
				if(n){
					n.ui.show();
				}
			}
		}
		this.filtered={};
	}};
Ext.tree.TreeSorter=function(tree,config){
	Ext.apply(this,config);
	tree.on("beforechildrenrendered",this.doSort,this);
	tree.on("append",this.updateSort,this);
	tree.on("insert",this.updateSort,this);
	tree.on("textchange",this.updateSortParent,this);
	var dsc=this.dir&&this.dir.toLowerCase()=="desc";
	var p=this.property||"text";
	var sortType=this.sortType;
	var fs=this.folderSort;
	var cs=this.caseSensitive===true;
	var leafAttr=this.leafAttr||'leaf';
	this.sortFn=function(n1,n2){
		if(fs){
			if(n1.attributes[leafAttr]&&!n2.attributes[leafAttr]){
				return 1;
			}
			if(!n1.attributes[leafAttr]&&n2.attributes[leafAttr]){
				return-1;
			}
		}
		var v1=sortType?sortType(n1):(cs?n1.attributes[p]:n1.attributes[p].toUpperCase());
		var v2=sortType?sortType(n2):(cs?n2.attributes[p]:n2.attributes[p].toUpperCase());
		if(v1<v2){
			return dsc?+1:-1;
		}else if(v1>v2){
			return dsc?-1:+1;
		}else{
			return 0;
		}
	};};
Ext.tree.TreeSorter.prototype={
	doSort:function(node){
		node.sort(this.sortFn);
	},
	compareNodes:function(n1,n2){
		return(n1.text.toUpperCase()>n2.text.toUpperCase()?1:-1);
	},
	updateSort:function(tree,node){
		if(node.childrenRendered){
			this.doSort.defer(1,this,[node]);
		}
	},
	updateSortParent:function(node){
		var p=node.parentNode;
		if(p&&p.childrenRendered){
			this.doSort.defer(1,this,[p]);
		}
	}};
if(Ext.dd.DropZone){
Ext.tree.TreeDropZone=function(tree,config){
	this.allowParentInsert=config.allowParentInsert||false;
	this.allowContainerDrop=config.allowContainerDrop||false;
	this.appendOnly=config.appendOnly||false;
	Ext.tree.TreeDropZone.superclass.constructor.call(this,tree.getTreeEl(),config);
	this.tree=tree;
	this.dragOverData={};
	this.lastInsertClass="x-tree-no-status";};
Ext.extend(Ext.tree.TreeDropZone,Ext.dd.DropZone,{
	ddGroup:"TreeDD",
	expandDelay:1000,
	expandNode:function(node){
		if(node.hasChildNodes()&&!node.isExpanded()){
			node.expand(false,null,this.triggerCacheRefresh.createDelegate(this));
		}
	},
	queueExpand:function(node){
		this.expandProcId=this.expandNode.defer(this.expandDelay,this,[node]);
	},
	cancelExpand:function(){
		if(this.expandProcId){
			clearTimeout(this.expandProcId);
			this.expandProcId=false;
		}
	},
	isValidDropPoint:function(n,pt,dd,e,data){
		if(!n||!data){return false;}
		var targetNode=n.node;
		var dropNode=data.node;
		if(!(targetNode&&targetNode.isTarget&&pt)){
			return false;
		}
		if(pt=="append"&&targetNode.allowChildren===false){
			return false;
		}
		if((pt=="above"||pt=="below")&&(targetNode.parentNode&&targetNode.parentNode.allowChildren===false)){
			return false;
		}
		if(dropNode&&(targetNode==dropNode||dropNode.contains(targetNode))){
			return false;
		}
		var overEvent=this.dragOverData;
		overEvent.tree=this.tree;
		overEvent.target=targetNode;
		overEvent.data=data;
		overEvent.point=pt;
		overEvent.source=dd;
		overEvent.rawEvent=e;
		overEvent.dropNode=dropNode;
		overEvent.cancel=false;
		var result=this.tree.fireEvent("nodedragover",overEvent);
		return overEvent.cancel===false&&result!==false;
	},
	getDropPoint:function(e,n,dd){
		var tn=n.node;
		if(tn.isRoot){
			return tn.allowChildren!==false?"append":false;
		}
		var dragEl=n.ddel;
		var t=Ext.lib.Dom.getY(dragEl),b=t+dragEl.offsetHeight;
		var y=Ext.lib.Event.getPageY(e);
		var noAppend=tn.allowChildren===false||tn.isLeaf();
		if(this.appendOnly||tn.parentNode.allowChildren===false){
			return noAppend?false:"append";
		}
		var noBelow=false;
		if(!this.allowParentInsert){
			noBelow=tn.hasChildNodes()&&tn.isExpanded();
		}
		var q=(b-t)/(noAppend?2:3);
		if(y>=t&&y<(t+q)){
			return"above";
		}else if(!noBelow&&(noAppend||y>=b-q&&y<=b)){
			return"below";
		}else{
			return"append";
		}
	},
	onNodeEnter:function(n,dd,e,data){
		this.cancelExpand();
	},
	onContainerOver:function(dd,e,data){
		if(this.allowContainerDrop&&this.isValidDropPoint({ddel:this.tree.getRootNode().ui.elNode,node:this.tree.getRootNode()},"append",dd,e,data)){
			return this.dropAllowed;
		}
		return this.dropNotAllowed;
	},
	onNodeOver:function(n,dd,e,data){
		var pt=this.getDropPoint(e,n,dd);
		var node=n.node;
		if(!this.expandProcId&&pt=="append"&&node.hasChildNodes()&&!n.node.isExpanded()){
			this.queueExpand(node);
		}else if(pt!="append"){
			this.cancelExpand();
		}
		var returnCls=this.dropNotAllowed;
		if(this.isValidDropPoint(n,pt,dd,e,data)){
		 if(pt){
			 var el=n.ddel;
			 var cls;
			 if(pt=="above"){
				 returnCls=n.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";
				 cls="x-tree-drag-insert-above";
			}else if(pt=="below"){
				 returnCls=n.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";
				 cls="x-tree-drag-insert-below";
			}else{
				 returnCls="x-tree-drop-ok-append";
				 cls="x-tree-drag-append";
			}
			 if(this.lastInsertClass!=cls){
				 Ext.fly(el).replaceClass(this.lastInsertClass,cls);
				 this.lastInsertClass=cls;
			}
		}
	}
	 return returnCls;
	},
	onNodeOut:function(n,dd,e,data){
		this.cancelExpand();
		this.removeDropIndicators(n);
	},
	onNodeDrop:function(n,dd,e,data){
		var point=this.getDropPoint(e,n,dd);
		var targetNode=n.node;
		targetNode.ui.startDrop();
		if(!this.isValidDropPoint(n,point,dd,e,data)){
			targetNode.ui.endDrop();
			return false;
		}
		var dropNode=data.node||(dd.getTreeNode?dd.getTreeNode(data,targetNode,point,e):null);
		return this.processDrop(targetNode,data,point,dd,e,dropNode);
	},
	onContainerDrop:function(dd,e,data){
		if(this.allowContainerDrop&&this.isValidDropPoint({ddel:this.tree.getRootNode().ui.elNode,node:this.tree.getRootNode()},"append",dd,e,data)){
			var targetNode=this.tree.getRootNode();
			targetNode.ui.startDrop();
			var dropNode=data.node||(dd.getTreeNode?dd.getTreeNode(data,targetNode,'append',e):null);
			return this.processDrop(targetNode,data,'append',dd,e,dropNode);
		}
		return false;
	},
	processDrop:function(target,data,point,dd,e,dropNode){
		var dropEvent={
			tree:this.tree,
			target:target,
			data:data,
			point:point,
			source:dd,
			rawEvent:e,
			dropNode:dropNode,
			cancel:!dropNode,
			dropStatus:false
		};
		var retval=this.tree.fireEvent("beforenodedrop",dropEvent);
		if(retval===false||dropEvent.cancel===true||!dropEvent.dropNode){
			target.ui.endDrop();
			return dropEvent.dropStatus;
		}
		target=dropEvent.target;
		if(point=='append'&&!target.isExpanded()){
			target.expand(false,null,function(){
				this.completeDrop(dropEvent);
			}.createDelegate(this));
		}else{
			this.completeDrop(dropEvent);
		}
		return true;
	},
	completeDrop:function(de){
		var ns=de.dropNode,p=de.point,t=de.target;
		if(!Ext.isArray(ns)){
			ns=[ns];
		}
		var n;
		for(var i=0,len=ns.length;i<len;i++){
			n=ns[i];
			if(p=="above"){
				t.parentNode.insertBefore(n,t);
			}else if(p=="below"){
				t.parentNode.insertBefore(n,t.nextSibling);
			}else{
				t.appendChild(n);
			}
		}
		n.ui.focus();
		if(Ext.enableFx&&this.tree.hlDrop){
			n.ui.highlight();
		}
		t.ui.endDrop();
		this.tree.fireEvent("nodedrop",de);
	},
	afterNodeMoved:function(dd,data,e,targetNode,dropNode){
		if(Ext.enableFx&&this.tree.hlDrop){
			dropNode.ui.focus();
			dropNode.ui.highlight();
		}
		this.tree.fireEvent("nodedrop",this.tree,targetNode,data,dd,e);
	},
	getTree:function(){
		return this.tree;
	},
	removeDropIndicators:function(n){
		if(n&&n.ddel){
			var el=n.ddel;
			Ext.fly(el).removeClass([
					"x-tree-drag-insert-above",
					"x-tree-drag-insert-below",
					"x-tree-drag-append"]);
			this.lastInsertClass="_noclass";
		}
	},
	beforeDragDrop:function(target,e,id){
		this.cancelExpand();
		return true;
	},
	afterRepair:function(data){
		if(data&&Ext.enableFx){
			data.node.ui.highlight();
		}
		this.hideProxy();
	}});}
if(Ext.dd.DragZone){
Ext.tree.TreeDragZone=function(tree,config){
	Ext.tree.TreeDragZone.superclass.constructor.call(this,tree.innerCt,config);
	this.tree=tree;};
Ext.extend(Ext.tree.TreeDragZone,Ext.dd.DragZone,{
	ddGroup:"TreeDD",
	onBeforeDrag:function(data,e){
		var n=data.node;
		return n&&n.draggable&&!n.disabled;
	},
	onInitDrag:function(e){
		var data=this.dragData;
		this.tree.getSelectionModel().select(data.node);
		this.tree.eventModel.disable();
		this.proxy.update("");
		data.node.ui.appendDDGhost(this.proxy.ghost.dom);
		this.tree.fireEvent("startdrag",this.tree,data.node,e);
	},
	getRepairXY:function(e,data){
		return data.node.ui.getDDRepairXY();
	},
	onEndDrag:function(data,e){
		this.tree.eventModel.enable.defer(100,this.tree.eventModel);
		this.tree.fireEvent("enddrag",this.tree,data.node,e);
	},
	onValidDrop:function(dd,e,id){
		this.tree.fireEvent("dragdrop",this.tree,this.dragData.node,dd,e);
		this.hideProxy();
	},
	beforeInvalidDrop:function(e,id){
		var sm=this.tree.getSelectionModel();
		sm.clearSelections();
		sm.select(this.dragData.node);
	},
	afterRepair:function(){
		if(Ext.enableFx&&this.tree.hlDrop){
			Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9");
		}
		this.dragging=false;
	}});}
Ext.tree.TreeEditor=function(tree,fc,config){
	fc=fc||{};
	var field=fc.events?fc:new Ext.form.TextField(fc);
	Ext.tree.TreeEditor.superclass.constructor.call(this,field,config);
	this.tree=tree;
	if(!tree.rendered){
		tree.on('render',this.initEditor,this);
	}else{
		this.initEditor(tree);
	}};
Ext.extend(Ext.tree.TreeEditor,Ext.Editor,{
	alignment:"l-l",
	autoSize:false,
	hideEl:false,
	cls:"x-small-editor x-tree-editor",
	shim:false,
	shadow:"frame",
	maxWidth:250,
	editDelay:350,
	initEditor:function(tree){
		tree.on('beforeclick',this.beforeNodeClick,this);
		tree.on('dblclick',this.onNodeDblClick,this);
		this.on('complete',this.updateNode,this);
		this.on('beforestartedit',this.fitToTree,this);
		this.on('startedit',this.bindScroll,this,{delay:10});
		this.on('specialkey',this.onSpecialKey,this);
	},
	fitToTree:function(ed,el){
		var td=this.tree.getTreeEl().dom,nd=el.dom;
		if(td.scrollLeft>nd.offsetLeft){
			td.scrollLeft=nd.offsetLeft;
		}
		var w=Math.min(
				this.maxWidth,
				(td.clientWidth>20?td.clientWidth:td.offsetWidth)-Math.max(0,nd.offsetLeft-td.scrollLeft)-5);
		this.setSize(w,'');
	},
	triggerEdit:function(node,defer){
		this.completeEdit();
		if(node.attributes.editable!==false){
			this.editNode=node;
			if(this.tree.autoScroll){
				Ext.fly(node.ui.getEl()).scrollIntoView(this.tree.body);
			}
			var value=node.text||'';
			if(!Ext.isGecko&&Ext.isEmpty(node.text)){
				node.setText('&#160;');
			}
			this.autoEditTimer=this.startEdit.defer(this.editDelay,this,[node.ui.textNode,value]);
			return false;
		}
	},
	bindScroll:function(){
		this.tree.getTreeEl().on('scroll',this.cancelEdit,this);
	},
	beforeNodeClick:function(node,e){
		clearTimeout(this.autoEditTimer);
		if(this.tree.getSelectionModel().isSelected(node)){
			e.stopEvent();
			return this.triggerEdit(node);
		}
	},
	onNodeDblClick:function(node,e){
		clearTimeout(this.autoEditTimer);
	},
	updateNode:function(ed,value){
		this.tree.getTreeEl().un('scroll',this.cancelEdit,this);
		this.editNode.setText(value);
	},
	onHide:function(){
		Ext.tree.TreeEditor.superclass.onHide.call(this);
		if(this.editNode){
			this.editNode.ui.focus.defer(50,this.editNode.ui);
		}
	},
	onSpecialKey:function(field,e){
		var k=e.getKey();
		if(k==e.ESC){
			e.stopEvent();
			this.cancelEdit();
		}else if(k==e.ENTER&&!e.hasModifier()){
			e.stopEvent();
			this.completeEdit();
		}
	}});
var swfobject=function(){
	var UNDEF="undefined",
		OBJECT="object",
		SHOCKWAVE_FLASH="Shockwave Flash",
		SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",
		FLASH_MIME_TYPE="application/x-shockwave-flash",
		EXPRESS_INSTALL_ID="SWFObjectExprInst",
		ON_READY_STATE_CHANGE="onreadystatechange",
		win=window,
		doc=document,
		nav=navigator,
		plugin=false,
		domLoadFnArr=[main],
		regObjArr=[],
		objIdArr=[],
		listenersArr=[],
		storedAltContent,
		storedAltContentId,
		storedCallbackFn,
		storedCallbackObj,
		isDomLoaded=false,
		isExpressInstallActive=false,
		dynamicStylesheet,
		dynamicStylesheetMedia,
		autoHideShow=true,
	ua=function(){
		var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF,
			u=nav.userAgent.toLowerCase(),
			p=nav.platform.toLowerCase(),
			windows=p?/win/.test(p):/win/.test(u),
			mac=p?/mac/.test(p):/mac/.test(u),
			webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,
			ie=!+"\v1",
			playerVersion=[0,0,0],
			d=null;
		if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT){
			d=nav.plugins[SHOCKWAVE_FLASH].description;
			if(d&&!(typeof nav.mimeTypes!=UNDEF&&nav.mimeTypes[FLASH_MIME_TYPE]&&!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)){
				plugin=true;
				ie=false;
				d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");
				playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);
				playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);
				playerVersion[2]=/[a-zA-Z]/.test(d)?parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;
			}
		}
		else if(typeof win.ActiveXObject!=UNDEF){
			try{
				var a=new ActiveXObject(SHOCKWAVE_FLASH_AX);
				if(a){
					d=a.GetVariable("$version");
					if(d){
						ie=true;
						d=d.split(" ")[1].split(",");
						playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];
					}
				}
			}
			catch(e){}
		}
		return{w3:w3cdom,pv:playerVersion,wk:webkit,ie:ie,win:windows,mac:mac};
	}(),
	onDomLoad=function(){
		if(!ua.w3){return;}
		if((typeof doc.readyState!=UNDEF&&doc.readyState=="complete")||(typeof doc.readyState==UNDEF&&(doc.getElementsByTagName("body")[0]||doc.body))){
			callDomLoadFunctions();
		}
		if(!isDomLoaded){
			if(typeof doc.addEventListener!=UNDEF){
				doc.addEventListener("DOMContentLoaded",callDomLoadFunctions,false);
			}
			if(ua.ie&&ua.win){
				doc.attachEvent(ON_READY_STATE_CHANGE,function(){
					if(doc.readyState=="complete"){
						doc.detachEvent(ON_READY_STATE_CHANGE,arguments.callee);
						callDomLoadFunctions();
					}
				});
				if(win==top){
					(function(){
						if(isDomLoaded){return;}
						try{
							doc.documentElement.doScroll("left");
						}
						catch(e){
							setTimeout(arguments.callee,0);
							return;
						}
						callDomLoadFunctions();
					})();
				}
			}
			if(ua.wk){
				(function(){
					if(isDomLoaded){return;}
					if(!/loaded|complete/.test(doc.readyState)){
						setTimeout(arguments.callee,0);
						return;
					}
					callDomLoadFunctions();
				})();
			}
			addLoadEvent(callDomLoadFunctions);
		}
	}();
	function callDomLoadFunctions(){
		if(isDomLoaded){return;}
		try{
			var t=doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
			t.parentNode.removeChild(t);
		}
		catch(e){return;}
		isDomLoaded=true;
		var dl=domLoadFnArr.length;
		for(var i=0;i<dl;i++){
			domLoadFnArr[i]();
		}
	}
	function addDomLoadEvent(fn){
		if(isDomLoaded){
			fn();
		}
		else{
			domLoadFnArr[domLoadFnArr.length]=fn;
		}
	}
	function addLoadEvent(fn){
		if(typeof win.addEventListener!=UNDEF){
			win.addEventListener("load",fn,false);
		}
		else if(typeof doc.addEventListener!=UNDEF){
			doc.addEventListener("load",fn,false);
		}
		else if(typeof win.attachEvent!=UNDEF){
			addListener(win,"onload",fn);
		}
		else if(typeof win.onload=="function"){
			var fnOld=win.onload;
			win.onload=function(){
				fnOld();
				fn();
			};
		}
		else{
			win.onload=fn;
		}
	}
	function main(){
		if(plugin){
			testPlayerVersion();
		}
		else{
			matchVersions();
		}
	}
	function testPlayerVersion(){
		var b=doc.getElementsByTagName("body")[0];
		var o=createElement(OBJECT);
		o.setAttribute("type",FLASH_MIME_TYPE);
		var t=b.appendChild(o);
		if(t){
			var counter=0;
			(function(){
				if(typeof t.GetVariable!=UNDEF){
					var d=t.GetVariable("$version");
					if(d){
						d=d.split(" ")[1].split(",");
						ua.pv=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];
					}
				}
				else if(counter<10){
					counter++;
					setTimeout(arguments.callee,10);
					return;
				}
				b.removeChild(o);
				t=null;
				matchVersions();
			})();
		}
		else{
			matchVersions();
		}
	}
	function matchVersions(){
		var rl=regObjArr.length;
		if(rl>0){
			for(var i=0;i<rl;i++){
				var id=regObjArr[i].id;
				var cb=regObjArr[i].callbackFn;
				var cbObj={success:false,id:id};
				if(ua.pv[0]>0){
					var obj=getElementById(id);
					if(obj){
						if(hasPlayerVersion(regObjArr[i].swfVersion)&&!(ua.wk&&ua.wk<312)){
							setVisibility(id,true);
							if(cb){
								cbObj.success=true;
								cbObj.ref=getObjectById(id);
								cb(cbObj);
							}
						}
						else if(regObjArr[i].expressInstall&&canExpressInstall()){
							var att={};
							att.data=regObjArr[i].expressInstall;
							att.width=obj.getAttribute("width")||"0";
							att.height=obj.getAttribute("height")||"0";
							if(obj.getAttribute("class")){att.styleclass=obj.getAttribute("class");}
							if(obj.getAttribute("align")){att.align=obj.getAttribute("align");}
							var par={};
							var p=obj.getElementsByTagName("param");
							var pl=p.length;
							for(var j=0;j<pl;j++){
								if(p[j].getAttribute("name").toLowerCase()!="movie"){
									par[p[j].getAttribute("name")]=p[j].getAttribute("value");
								}
							}
							showExpressInstall(att,par,id,cb);
						}
						else{
							displayAltContent(obj);
							if(cb){cb(cbObj);}
						}
					}
				}
				else{
					setVisibility(id,true);
					if(cb){
						var o=getObjectById(id);
						if(o&&typeof o.SetVariable!=UNDEF){
							cbObj.success=true;
							cbObj.ref=o;
						}
						cb(cbObj);
					}
				}
			}
		}
	}
	function getObjectById(objectIdStr){
		var r=null;
		var o=getElementById(objectIdStr);
		if(o&&o.nodeName=="OBJECT"){
			if(typeof o.SetVariable!=UNDEF){
				r=o;
			}
			else{
				var n=o.getElementsByTagName(OBJECT)[0];
				if(n){
					r=n;
				}
			}
		}
		return r;
	}
	function canExpressInstall(){
		return!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)&&!(ua.wk&&ua.wk<312);
	}
	function showExpressInstall(att,par,replaceElemIdStr,callbackFn){
		isExpressInstallActive=true;
		storedCallbackFn=callbackFn||null;
		storedCallbackObj={success:false,id:replaceElemIdStr};
		var obj=getElementById(replaceElemIdStr);
		if(obj){
			if(obj.nodeName=="OBJECT"){
				storedAltContent=abstractAltContent(obj);
				storedAltContentId=null;
			}
			else{
				storedAltContent=obj;
				storedAltContentId=replaceElemIdStr;
			}
			att.id=EXPRESS_INSTALL_ID;
			if(typeof att.width==UNDEF||(!/%$/.test(att.width)&&parseInt(att.width,10)<310)){att.width="310";}
			if(typeof att.height==UNDEF||(!/%$/.test(att.height)&&parseInt(att.height,10)<137)){att.height="137";}
			doc.title=doc.title.slice(0,47)+" - Flash Player Installation";
			var pt=ua.ie&&ua.win?"ActiveX":"PlugIn",
				fv="MMredirectURL="+win.location.toString().replace(/&/g,"%26")+"&MMplayerType="+pt+"&MMdoctitle="+doc.title;
			if(typeof par.flashvars!=UNDEF){
				par.flashvars+="&"+fv;
			}
			else{
				par.flashvars=fv;
			}
			if(ua.ie&&ua.win&&obj.readyState!=4){
				var newObj=createElement("div");
				replaceElemIdStr+="SWFObjectNew";
				newObj.setAttribute("id",replaceElemIdStr);
				obj.parentNode.insertBefore(newObj,obj);
				obj.style.display="none";
				(function(){
					if(obj.readyState==4){
						obj.parentNode.removeChild(obj);
					}
					else{
						setTimeout(arguments.callee,10);
					}
				})();
			}
			createSWF(att,par,replaceElemIdStr);
		}
	}
	function displayAltContent(obj){
		if(ua.ie&&ua.win&&obj.readyState!=4){
			var el=createElement("div");
			obj.parentNode.insertBefore(el,obj);
			el.parentNode.replaceChild(abstractAltContent(obj),el);
			obj.style.display="none";
			(function(){
				if(obj.readyState==4){
					obj.parentNode.removeChild(obj);
				}
				else{
					setTimeout(arguments.callee,10);
				}
			})();
		}
		else{
			obj.parentNode.replaceChild(abstractAltContent(obj),obj);
		}
	}
	function abstractAltContent(obj){
		var ac=createElement("div");
		if(ua.win&&ua.ie){
			ac.innerHTML=obj.innerHTML;
		}
		else{
			var nestedObj=obj.getElementsByTagName(OBJECT)[0];
			if(nestedObj){
				var c=nestedObj.childNodes;
				if(c){
					var cl=c.length;
					for(var i=0;i<cl;i++){
						if(!(c[i].nodeType==1&&c[i].nodeName=="PARAM")&&!(c[i].nodeType==8)){
							ac.appendChild(c[i].cloneNode(true));
						}
					}
				}
			}
		}
		return ac;
	}
	function createSWF(attObj,parObj,id){
		var r,el=getElementById(id);
		if(ua.wk&&ua.wk<312){return r;}
		if(el){
			if(typeof attObj.id==UNDEF){
				attObj.id=id;
			}
			if(ua.ie&&ua.win){
				var att="";
				for(var i in attObj){
					if(attObj[i]!=Object.prototype[i]){
						if(i.toLowerCase()=="data"){
							parObj.movie=attObj[i];
						}
						else if(i.toLowerCase()=="styleclass"){
							att+=' class="'+attObj[i]+'"';
						}
						else if(i.toLowerCase()!="classid"){
							att+=' '+i+'="'+attObj[i]+'"';
						}
					}
				}
				var par="";
				for(var j in parObj){
					if(parObj[j]!=Object.prototype[j]){
						par+='<param name="'+j+'" value="'+parObj[j]+'" />';
					}
				}
				el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+'>'+par+'</object>';
				objIdArr[objIdArr.length]=attObj.id;
				r=getElementById(attObj.id);
			}
			else{
				var o=createElement(OBJECT);
				o.setAttribute("type",FLASH_MIME_TYPE);
				for(var m in attObj){
					if(attObj[m]!=Object.prototype[m]){
						if(m.toLowerCase()=="styleclass"){
							o.setAttribute("class",attObj[m]);
						}
						else if(m.toLowerCase()!="classid"){
							o.setAttribute(m,attObj[m]);
						}
					}
				}
				for(var n in parObj){
					if(parObj[n]!=Object.prototype[n]&&n.toLowerCase()!="movie"){
						createObjParam(o,n,parObj[n]);
					}
				}
				el.parentNode.replaceChild(o,el);
				r=o;
			}
		}
		return r;
	}
	function createObjParam(el,pName,pValue){
		var p=createElement("param");
		p.setAttribute("name",pName);
		p.setAttribute("value",pValue);
		el.appendChild(p);
	}
	function removeSWF(id){
		var obj=getElementById(id);
		if(obj&&obj.nodeName=="OBJECT"){
			if(ua.ie&&ua.win){
				obj.style.display="none";
				(function(){
					if(obj.readyState==4){
						removeObjectInIE(id);
					}
					else{
						setTimeout(arguments.callee,10);
					}
				})();
			}
			else{
				obj.parentNode.removeChild(obj);
			}
		}
	}
	function removeObjectInIE(id){
		var obj=getElementById(id);
		if(obj){
			for(var i in obj){
				if(typeof obj[i]=="function"){
					obj[i]=null;
				}
			}
			obj.parentNode.removeChild(obj);
		}
	}
	function getElementById(id){
		var el=null;
		try{
			el=doc.getElementById(id);
		}
		catch(e){}
		return el;
	}
	function createElement(el){
		return doc.createElement(el);
	}
	function addListener(target,eventType,fn){
		target.attachEvent(eventType,fn);
		listenersArr[listenersArr.length]=[target,eventType,fn];
	}
	function hasPlayerVersion(rv){
		var pv=ua.pv,v=rv.split(".");
		v[0]=parseInt(v[0],10);
		v[1]=parseInt(v[1],10)||0;
		v[2]=parseInt(v[2],10)||0;
		return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false;
	}
	function createCSS(sel,decl,media,newStyle){
		if(ua.ie&&ua.mac){return;}
		var h=doc.getElementsByTagName("head")[0];
		if(!h){return;}
		var m=(media&&typeof media=="string")?media:"screen";
		if(newStyle){
			dynamicStylesheet=null;
			dynamicStylesheetMedia=null;
		}
		if(!dynamicStylesheet||dynamicStylesheetMedia!=m){
			var s=createElement("style");
			s.setAttribute("type","text/css");
			s.setAttribute("media",m);
			dynamicStylesheet=h.appendChild(s);
			if(ua.ie&&ua.win&&typeof doc.styleSheets!=UNDEF&&doc.styleSheets.length>0){
				dynamicStylesheet=doc.styleSheets[doc.styleSheets.length-1];
			}
			dynamicStylesheetMedia=m;
		}
		if(ua.ie&&ua.win){
			if(dynamicStylesheet&&typeof dynamicStylesheet.addRule==OBJECT){
				dynamicStylesheet.addRule(sel,decl);
			}
		}
		else{
			if(dynamicStylesheet&&typeof doc.createTextNode!=UNDEF){
				dynamicStylesheet.appendChild(doc.createTextNode(sel+" {"+decl+"}"));
			}
		}
	}
	function setVisibility(id,isVisible){
		if(!autoHideShow){return;}
		var v=isVisible?"visible":"hidden";
		if(isDomLoaded&&getElementById(id)){
			getElementById(id).style.visibility=v;
		}
		else{
			createCSS("#"+id,"visibility:"+v);
		}
	}
	function urlEncodeIfNecessary(s){
		var regex=/[\\\"<>\.;]/;
		var hasBadChars=regex.exec(s)!=null;
		return hasBadChars&&typeof encodeURIComponent!=UNDEF?encodeURIComponent(s):s;
	}
	var cleanup=function(){
		if(ua.ie&&ua.win){
			window.attachEvent("onunload",function(){
				var ll=listenersArr.length;
				for(var i=0;i<ll;i++){
					listenersArr[i][0].detachEvent(listenersArr[i][1],listenersArr[i][2]);
				}
				var il=objIdArr.length;
				for(var j=0;j<il;j++){
					removeSWF(objIdArr[j]);
				}
				for(var k in ua){
					ua[k]=null;
				}
				ua=null;
				for(var l in swfobject){
					swfobject[l]=null;
				}
				swfobject=null;
			});
		}
	}();
	return{
		registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr,callbackFn){
			if(ua.w3&&objectIdStr&&swfVersionStr){
				var regObj={};
				regObj.id=objectIdStr;
				regObj.swfVersion=swfVersionStr;
				regObj.expressInstall=xiSwfUrlStr;
				regObj.callbackFn=callbackFn;
				regObjArr[regObjArr.length]=regObj;
				setVisibility(objectIdStr,false);
			}
			else if(callbackFn){
				callbackFn({success:false,id:objectIdStr});
			}
		},
		getObjectById:function(objectIdStr){
			if(ua.w3){
				return getObjectById(objectIdStr);
			}
		},
		embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj,callbackFn){
			var callbackObj={success:false,id:replaceElemIdStr};
			if(ua.w3&&!(ua.wk&&ua.wk<312)&&swfUrlStr&&replaceElemIdStr&&widthStr&&heightStr&&swfVersionStr){
				setVisibility(replaceElemIdStr,false);
				addDomLoadEvent(function(){
					widthStr+="";
					heightStr+="";
					var att={};
					if(attObj&&typeof attObj===OBJECT){
						for(var i in attObj){
							att[i]=attObj[i];
						}
					}
					att.data=swfUrlStr;
					att.width=widthStr;
					att.height=heightStr;
					var par={};
					if(parObj&&typeof parObj===OBJECT){
						for(var j in parObj){
							par[j]=parObj[j];
						}
					}
					if(flashvarsObj&&typeof flashvarsObj===OBJECT){
						for(var k in flashvarsObj){
							if(typeof par.flashvars!=UNDEF){
								par.flashvars+="&"+k+"="+flashvarsObj[k];
							}
							else{
								par.flashvars=k+"="+flashvarsObj[k];
							}
						}
					}
					if(hasPlayerVersion(swfVersionStr)){
						var obj=createSWF(att,par,replaceElemIdStr);
						if(att.id==replaceElemIdStr){
							setVisibility(replaceElemIdStr,true);
						}
						callbackObj.success=true;
						callbackObj.ref=obj;
					}
					else if(xiSwfUrlStr&&canExpressInstall()){
						att.data=xiSwfUrlStr;
						showExpressInstall(att,par,replaceElemIdStr,callbackFn);
						return;
					}
					else{
						setVisibility(replaceElemIdStr,true);
					}
					if(callbackFn){callbackFn(callbackObj);}
				});
			}
			else if(callbackFn){callbackFn(callbackObj);}
		},
		switchOffAutoHideShow:function(){
			autoHideShow=false;
		},
		ua:ua,
		getFlashPlayerVersion:function(){
			return{major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]};
		},
		hasFlashPlayerVersion:hasPlayerVersion,
		createSWF:function(attObj,parObj,replaceElemIdStr){
			if(ua.w3){
				return createSWF(attObj,parObj,replaceElemIdStr);
			}
			else{
				return undefined;
			}
		},
		showExpressInstall:function(att,par,replaceElemIdStr,callbackFn){
			if(ua.w3&&canExpressInstall()){
				showExpressInstall(att,par,replaceElemIdStr,callbackFn);
			}
		},
		removeSWF:function(objElemIdStr){
			if(ua.w3){
				removeSWF(objElemIdStr);
			}
		},
		createCSS:function(selStr,declStr,mediaStr,newStyleBoolean){
			if(ua.w3){
				createCSS(selStr,declStr,mediaStr,newStyleBoolean);
			}
		},
		addDomLoadEvent:addDomLoadEvent,
		addLoadEvent:addLoadEvent,
		getQueryParamValue:function(param){
			var q=doc.location.search||doc.location.hash;
			if(q){
				if(/\?/.test(q)){q=q.split("?")[1];}
				if(param==null){
					return urlEncodeIfNecessary(q);
				}
				var pairs=q.split("&");
				for(var i=0;i<pairs.length;i++){
					if(pairs[i].substring(0,pairs[i].indexOf("="))==param){
						return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=")+1)));
					}
				}
			}
			return"";
		},
		expressInstallCallback:function(){
			if(isExpressInstallActive){
				var obj=getElementById(EXPRESS_INSTALL_ID);
				if(obj&&storedAltContent){
					obj.parentNode.replaceChild(storedAltContent,obj);
					if(storedAltContentId){
						setVisibility(storedAltContentId,true);
						if(ua.ie&&ua.win){storedAltContent.style.display="block";}
					}
					if(storedCallbackFn){storedCallbackFn(storedCallbackObj);}
				}
				isExpressInstallActive=false;
			}
		}
	};}();
Ext.FlashComponent=Ext.extend(Ext.BoxComponent,{
	flashVersion:'9.0.45',
	backgroundColor:'#ffffff',
	wmode:'opaque',
	url:undefined,
	swfId:undefined,
	swfWidth:'100%',
	swfHeight:'100%',
	expressInstall:false,
	initComponent:function(){
		Ext.FlashComponent.superclass.initComponent.call(this);
		this.addEvents('initialize');
	},
	onRender:function(){
		Ext.FlashComponent.superclass.onRender.apply(this,arguments);
		var params={
			allowScriptAccess:'always',
			bgcolor:this.backgroundColor,
			wmode:this.wmode
		},vars={
			allowedDomain:document.location.hostname,
			elementID:this.getId(),
			eventHandler:'Ext.FlashEventProxy.onEvent'
		};
		new swfobject.embedSWF(this.url,this.id,this.swfWidth,this.swfHeight,this.flashVersion,
			this.expressInstall?Ext.FlashComponent.EXPRESS_INSTALL_URL:undefined,vars,params);
		this.swf=Ext.getDom(this.id);
		this.el=Ext.get(this.swf);
	},
	getSwfId:function(){
		return this.swfId||(this.swfId="extswf"+(++Ext.Component.AUTO_ID));
	},
	getId:function(){
		return this.id||(this.id="extflashcmp"+(++Ext.Component.AUTO_ID));
	},
	onFlashEvent:function(e){
		switch(e.type){
			case"swfReady":
				this.initSwf();
				return;
			case"log":
				return;
		}
		e.component=this;
		this.fireEvent(e.type.toLowerCase().replace(/event$/,''),e);
	},
	initSwf:function(){
		this.onSwfReady(!!this.isInitialized);
		this.isInitialized=true;
		this.fireEvent('initialize',this);
	},
	beforeDestroy:function(){
		if(this.rendered){
			swfobject.removeSWF(this.swf.id);
		}
		Ext.FlashComponent.superclass.beforeDestroy.call(this);
	},
	onSwfReady:Ext.emptyFn});
Ext.FlashComponent.EXPRESS_INSTALL_URL='http:/'+'/swfobject.googlecode.com/svn/trunk/swfobject/expressInstall.swf';
Ext.reg('flash',Ext.FlashComponent);
Ext.FlashEventProxy={
	onEvent:function(id,e){
		var fp=Ext.getCmp(id);
		if(fp){
			fp.onFlashEvent(e);
		}else{
			arguments.callee.defer(10,this,[id,e]);
		}
	}}
Ext.chart.Chart=Ext.extend(Ext.FlashComponent,{
	refreshBuffer:100,
	chartStyle:{
		padding:10,
		animationEnabled:true,
		font:{
			name:'Tahoma',
			color:0x444444,
			size:11
		},
		dataTip:{
			padding:5,
			border:{
				color:0x99bbe8,
				size:1
			},
			background:{
				color:0xDAE7F6,
				alpha:.9
			},
			font:{
				name:'Tahoma',
				color:0x15428B,
				size:10,
				bold:true
			}
		}
	},
	extraStyle:null,
	disableCaching:Ext.isIE||Ext.isOpera,
	disableCacheParam:'_dc',
	initComponent:function(){
		Ext.chart.Chart.superclass.initComponent.call(this);
		if(!this.url){
			this.url=Ext.chart.Chart.CHART_URL;
		}
		if(this.disableCaching){
			this.url=Ext.urlAppend(this.url,String.format('{0}={1}',this.disableCacheParam,new Date().getTime()));
		}
		this.addEvents(
			'itemmouseover',
			'itemmouseout',
			'itemclick',
			'itemdoubleclick',
			'itemdragstart',
			'itemdrag',
			'itemdragend'
		);
		this.store=Ext.StoreMgr.lookup(this.store);
	},
	 setStyle:function(name,value){
		 this.swf.setStyle(name,Ext.encode(value));
	},
	setStyles:function(styles){
		this.swf.setStyles(Ext.encode(styles));
	},
	setSeriesStyles:function(styles){
		var s=[];
		Ext.each(styles,function(style){
			s.push(Ext.encode(style));
		});
		this.swf.setSeriesStyles(s);
	},
	setCategoryNames:function(names){
		this.swf.setCategoryNames(names);
	},
	setTipRenderer:function(fn){
		var chart=this;
		this.tipFnName=this.createFnProxy(function(item,index,series){
			var record=chart.store.getAt(index);
			return fn(chart,record,index,series);
		},this.tipFnName);
		this.swf.setDataTipFunction(this.tipFnName);
	},
	setSeries:function(series){
		this.series=series;
		this.refresh();
	},
	bindStore:function(store,initial){
		if(!initial&&this.store){
			this.store.un("datachanged",this.refresh,this);
			this.store.un("add",this.delayRefresh,this);
			this.store.un("remove",this.delayRefresh,this);
			this.store.un("update",this.delayRefresh,this);
			this.store.un("clear",this.refresh,this);
			if(store!==this.store&&this.store.autoDestroy){
				this.store.destroy();
			}
		}
		if(store){
			store=Ext.StoreMgr.lookup(store);
			store.on({
				scope:this,
				datachanged:this.refresh,
				add:this.delayRefresh,
				remove:this.delayRefresh,
				update:this.delayRefresh,
				clear:this.refresh
			});
		}
		this.store=store;
		if(store&&!initial){
			this.refresh();
		}
	},
	onSwfReady:function(isReset){
		Ext.chart.Chart.superclass.onSwfReady.call(this,isReset);
		this.swf.setType(this.type);
		if(this.chartStyle){
			this.setStyles(Ext.apply(this.extraStyle||{},this.chartStyle));
		}
		if(this.categoryNames){
			this.setCategoryNames(this.categoryNames);
		}
		if(this.tipRenderer){
			this.setTipRenderer(this.tipRenderer);
		}
		if(!isReset){
			this.bindStore(this.store,true);
		}
		this.refresh.defer(10,this);
	},
	delayRefresh:function(){
		if(!this.refreshTask){
			this.refreshTask=new Ext.util.DelayedTask(this.refresh,this);
		}
		this.refreshTask.delay(this.refreshBuffer);
	},
	refresh:function(){
		var styleChanged=false;
		var data=[],rs=this.store.data.items;
		for(var j=0,len=rs.length;j<len;j++){
			data[j]=rs[j].data;
		}
		var dataProvider=[];
		var seriesCount=0;
		var currentSeries=null;
		var i=0;
		if(this.series){
			seriesCount=this.series.length;
			for(i=0;i<seriesCount;i++){
				currentSeries=this.series[i];
				var clonedSeries={};
				for(var prop in currentSeries){
					if(prop=="style"&&currentSeries.style!==null){
						clonedSeries.style=Ext.encode(currentSeries.style);
						styleChanged=true;
					}else{
						clonedSeries[prop]=currentSeries[prop];
					}
				}
				dataProvider.push(clonedSeries);
			}
		}
		if(seriesCount>0){
			for(i=0;i<seriesCount;i++){
				currentSeries=dataProvider[i];
				if(!currentSeries.type){
					currentSeries.type=this.type;
				}
				currentSeries.dataProvider=data;
			}
		}else{
			dataProvider.push({type:this.type,dataProvider:data});
		}
		this.swf.setDataProvider(dataProvider);
	},
	createFnProxy:function(fn,old){
		if(old){
			delete window[old];
		}
		var fnName="extFnProxy"+(++Ext.chart.Chart.PROXY_FN_ID);
		window[fnName]=fn;
		return fnName;
	},
	onDestroy:function(){
		Ext.chart.Chart.superclass.onDestroy.call(this);
		delete window[this.tipFnName];
	}});
Ext.reg('chart',Ext.chart.Chart);
Ext.chart.Chart.PROXY_FN_ID=0;
Ext.chart.Chart.CHART_URL='http:/'+'/yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf';
Ext.chart.PieChart=Ext.extend(Ext.chart.Chart,{
	type:'pie',
	onSwfReady:function(isReset){
		Ext.chart.PieChart.superclass.onSwfReady.call(this,isReset);
		this.setDataField(this.dataField);
		this.setCategoryField(this.categoryField);
	},
	setDataField:function(field){
		this.dataField=field;
		this.swf.setDataField(field);
	},
	setCategoryField:function(field){
		this.categoryField=field;
		this.swf.setCategoryField(field);
	}});
Ext.reg('piechart',Ext.chart.PieChart);
Ext.chart.CartesianChart=Ext.extend(Ext.chart.Chart,{
	onSwfReady:function(isReset){
		Ext.chart.CartesianChart.superclass.onSwfReady.call(this,isReset);
		if(this.xField){
			this.setXField(this.xField);
		}
		if(this.yField){
			this.setYField(this.yField);
		}
		if(this.xAxis){
			this.setXAxis(this.xAxis);
		}
		if(this.yAxis){
			this.setYAxis(this.yAxis);
		}
	},
	setXField:function(value){
		this.xField=value;
		this.swf.setHorizontalField(value);
	},
	setYField:function(value){
		this.yField=value;
		this.swf.setVerticalField(value);
	},
	setXAxis:function(value){
		this.xAxis=this.createAxis('xAxis',value);
		this.swf.setHorizontalAxis(this.xAxis);
	},
	setYAxis:function(value){
		this.yAxis=this.createAxis('yAxis',value);
		this.swf.setVerticalAxis(this.yAxis);
	},
	createAxis:function(axis,value){
		var o=Ext.apply({},value),oldFn=null;
		if(this[axis]){
			oldFn=this[axis].labelFunction;
		}
		if(o.labelRenderer){
			var fn=o.labelRenderer;
			o.labelFunction=this.createFnProxy(function(v){
				return fn(v);
			},oldFn);
			delete o.labelRenderer;
		}
		return o;
	}});
Ext.reg('cartesianchart',Ext.chart.CartesianChart);
Ext.chart.LineChart=Ext.extend(Ext.chart.CartesianChart,{
	type:'line'});
Ext.reg('linechart',Ext.chart.LineChart);
Ext.chart.ColumnChart=Ext.extend(Ext.chart.CartesianChart,{
	type:'column'});
Ext.reg('columnchart',Ext.chart.ColumnChart);
Ext.chart.StackedColumnChart=Ext.extend(Ext.chart.CartesianChart,{
	type:'stackcolumn'});
Ext.reg('stackedcolumnchart',Ext.chart.StackedColumnChart);
Ext.chart.BarChart=Ext.extend(Ext.chart.CartesianChart,{
	type:'bar'});
Ext.reg('barchart',Ext.chart.BarChart);
Ext.chart.StackedBarChart=Ext.extend(Ext.chart.CartesianChart,{
	type:'stackbar'});
Ext.reg('stackedbarchart',Ext.chart.StackedBarChart);
Ext.chart.Axis=function(config){
	Ext.apply(this,config);};
Ext.chart.Axis.prototype=
{
	type:null,
	orientation:"horizontal",
	reverse:false,
	labelFunction:null,
	hideOverlappingLabels:true};
Ext.chart.NumericAxis=Ext.extend(Ext.chart.Axis,{
	type:"numeric",
	minimum:NaN,
	maximum:NaN,
	majorUnit:NaN,
	minorUnit:NaN,
	snapToUnits:true,
	alwaysShowZero:true,
	scale:"linear"});
Ext.chart.TimeAxis=Ext.extend(Ext.chart.Axis,{
	type:"time",
	minimum:null,
	maximum:null,
	majorUnit:NaN,
	majorTimeUnit:null,
	minorUnit:NaN,
	minorTimeUnit:null,
	snapToUnits:true});
Ext.chart.CategoryAxis=Ext.extend(Ext.chart.Axis,{
	type:"category",
	categoryNames:null});
Ext.chart.Series=function(config){Ext.apply(this,config);};
Ext.chart.Series.prototype=
{
	type:null,
	displayName:null};
Ext.chart.CartesianSeries=Ext.extend(Ext.chart.Series,{
	xField:null,
	yField:null});
Ext.chart.ColumnSeries=Ext.extend(Ext.chart.CartesianSeries,{
	type:"column"});
Ext.chart.LineSeries=Ext.extend(Ext.chart.CartesianSeries,{
	type:"line"});
Ext.chart.BarSeries=Ext.extend(Ext.chart.CartesianSeries,{
	type:"bar"});
Ext.chart.PieSeries=Ext.extend(Ext.chart.Series,{
	type:"pie",
	dataField:null,
	categoryField:null});
Ext.layout.MenuLayout=Ext.extend(Ext.layout.ContainerLayout,{
	monitorResize:true,
	setContainer:function(ct){
		this.monitorResize=!ct.floating;
		Ext.layout.MenuLayout.superclass.setContainer.call(this,ct);
	},
	renderItem:function(c,position,target){
		if(!this.itemTpl){
			this.itemTpl=Ext.layout.MenuLayout.prototype.itemTpl=new Ext.XTemplate(
				'<li id="{itemId}" class="{itemCls}">',
					'<tpl if="needsIcon">',
						'<img src="{icon}" class="{iconCls}"/>',
					'</tpl>',
				'</li>'
			);
		}
		if(c&&!c.rendered){
			if(Ext.isNumber(position)){
				position=target.dom.childNodes[position];
			}
			var a=this.getItemArgs(c);
			c.render(c.positionEl=position?
				this.itemTpl.insertBefore(position,a,true):
				this.itemTpl.append(target,a,true));
			c.positionEl.menuItemId=c.itemId||c.id;
			if(!a.isMenuItem&&a.needsIcon){
				c.positionEl.addClass('x-menu-list-item-indent');
			}
		}else if(c&&!this.isValidParent(c,target)){
			if(Ext.isNumber(position)){
				position=target.dom.childNodes[position];
			}
			target.dom.insertBefore(c.getActionEl().dom,position||null);
		}
	},
	getItemArgs:function(c){
		var isMenuItem=c instanceof Ext.menu.Item;
		return{
			isMenuItem:isMenuItem,
			needsIcon:!isMenuItem&&(c.icon||c.iconCls),
			icon:c.icon||Ext.BLANK_IMAGE_URL,
			iconCls:'x-menu-item-icon '+(c.iconCls||''),
			itemId:'x-menu-el-'+c.id,
			itemCls:'x-menu-list-item '+(this.extraCls||'')
		};
	},
	isValidParent:function(c,target){
		return c.el.up('li.x-menu-list-item',5).dom.parentNode===(target.dom||target);
	},
	onLayout:function(ct,target){
		this.renderAll(ct,target);
		this.doAutoSize();
	},
	doAutoSize:function(){
		var ct=this.container,w=ct.width;
		if(ct.floating){
			if(w){
				ct.setWidth(w);
			}else if(Ext.isIE){
				ct.setWidth(Ext.isStrict&&(Ext.isIE7||Ext.isIE8)?'auto':ct.minWidth);
				var el=ct.getEl(),t=el.dom.offsetWidth;
				ct.setWidth(ct.getLayoutTarget().getWidth()+el.getFrameWidth('lr'));
			}
		}
	}});
Ext.Container.LAYOUTS['menu']=Ext.layout.MenuLayout;
Ext.menu.Menu=Ext.extend(Ext.Container,{
	minWidth:120,
	shadow:"sides",
	subMenuAlign:"tl-tr?",
	defaultAlign:"tl-bl?",
	allowOtherMenus:false,
	ignoreParentClicks:false,
	enableScrolling:true,
	maxHeight:null,
	scrollIncrement:24,
	showSeparator:true,
	defaultOffsets:[0,0],
	floating:true,
	hidden:true,
	layout:'menu',
	hideMode:'offsets',
	scrollerHeight:8,
	autoLayout:true,
	defaultType:'menuitem',
	initComponent:function(){
		if(Ext.isArray(this.initialConfig)){
			Ext.apply(this,{items:this.initialConfig});
		}
		this.addEvents(
			'click',
			'mouseover',
			'mouseout',
			'itemclick'
		);
		Ext.menu.MenuMgr.register(this);
		if(this.floating){
			Ext.EventManager.onWindowResize(this.hide,this);
		}else{
			if(this.initialConfig.hidden!==false){
				this.hidden=false;
			}
			this.internalDefaults={hideOnClick:false};
		}
		Ext.menu.Menu.superclass.initComponent.call(this);
		if(this.autoLayout){
			this.on({
				add:this.doLayout,
				remove:this.doLayout,
				scope:this
			});
		}
	},
	getLayoutTarget:function(){
		return this.ul;
	},
	onRender:function(ct,position){
		if(!ct){
			ct=Ext.getBody();
		}
		var dh={
			id:this.getId(),
			cls:'x-menu '+((this.floating)?'x-menu-floating x-layer ':'')+(this.cls||'')+(this.plain?' x-menu-plain':'')+(this.showSeparator?'':' x-menu-nosep'),
			style:this.style,
			cn:[
				{tag:'a',cls:'x-menu-focus',href:'#',onclick:'return false;',tabIndex:'-1'},
				{tag:'ul',cls:'x-menu-list'}
			]
		};
		if(this.floating){
			this.el=new Ext.Layer({
				shadow:this.shadow,
				dh:dh,
				constrain:false,
				parentEl:ct,
				zindex:15000
			});
		}else{
			this.el=ct.createChild(dh);
		}
		Ext.menu.Menu.superclass.onRender.call(this,ct,position);
		if(!this.keyNav){
			this.keyNav=new Ext.menu.MenuNav(this);
		}
		this.focusEl=this.el.child('a.x-menu-focus');
		this.ul=this.el.child('ul.x-menu-list');
		this.mon(this.ul,{
			scope:this,
			click:this.onClick,
			mouseover:this.onMouseOver,
			mouseout:this.onMouseOut
		});
		if(this.enableScrolling){
			this.mon(this.el,{
				scope:this,
				delegate:'.x-menu-scroller',
				click:this.onScroll,
				mouseover:this.deactivateActive
			});
		}
	},
	findTargetItem:function(e){
		var t=e.getTarget(".x-menu-list-item",this.ul,true);
		if(t&&t.menuItemId){
			return this.items.get(t.menuItemId);
		}
	},
	onClick:function(e){
		var t=this.findTargetItem(e);
		if(t){
			if(t.isFormField){
				this.setActiveItem(t);
			}else{
				if(t.menu&&this.ignoreParentClicks){
					t.expandMenu();
					e.preventDefault();
				}else if(t.onClick){
					t.onClick(e);
					this.fireEvent("click",this,t,e);
				}
			}
		}
	},
	setActiveItem:function(item,autoExpand){
		if(item!=this.activeItem){
			this.deactivateActive();
			if((this.activeItem=item).isFormField){
				item.focus();
			}else{
				item.activate(autoExpand);
			}
		}else if(autoExpand){
			item.expandMenu();
		}
	},
	deactivateActive:function(){
		var a=this.activeItem;
		if(a){
			if(a.isFormField){
				if(a.collapse){
					a.collapse();
				}
			}else{
				a.deactivate();
			}
			delete this.activeItem;
		}
	},
	tryActivate:function(start,step){
		var items=this.items;
		for(var i=start,len=items.length;i>=0&&i<len;i+=step){
			var item=items.get(i);
			if(!item.disabled&&(item.canActivate||item.isFormField)){
				this.setActiveItem(item,false);
				return item;
			}
		}
		return false;
	},
	onMouseOver:function(e){
		var t=this.findTargetItem(e);
		if(t){
			if(t.canActivate&&!t.disabled){
				this.setActiveItem(t,true);
			}
		}
		this.over=true;
		this.fireEvent("mouseover",this,e,t);
	},
	onMouseOut:function(e){
		var t=this.findTargetItem(e);
		if(t){
			if(t==this.activeItem&&t.shouldDeactivate&&t.shouldDeactivate(e)){
				this.activeItem.deactivate();
				delete this.activeItem;
			}
		}
		this.over=false;
		this.fireEvent("mouseout",this,e,t);
	},
	onScroll:function(e,t){
		if(e){
			e.stopEvent();
		}
		var ul=this.ul.dom,top=Ext.fly(t).is('.x-menu-scroller-top');
		ul.scrollTop+=this.scrollIncrement*(top?-1:1);
		if(top?ul.scrollTop<=0:ul.scrollTop+this.activeMax>=ul.scrollHeight){
		 this.onScrollerOut(null,t);
		}
	},
	onScrollerIn:function(e,t){
		var ul=this.ul.dom,top=Ext.fly(t).is('.x-menu-scroller-top');
		if(top?ul.scrollTop>0:ul.scrollTop+this.activeMax<ul.scrollHeight){
			Ext.fly(t).addClass(['x-menu-item-active','x-menu-scroller-active']);
		}
	},
	onScrollerOut:function(e,t){
		Ext.fly(t).removeClass(['x-menu-item-active','x-menu-scroller-active']);
	},
	show:function(el,pos,parentMenu){
		if(this.floating){
			this.parentMenu=parentMenu;
			if(!this.el){
				this.render();
				this.doLayout(false,true);
			}
			if(this.fireEvent('beforeshow',this)!==false){
				this.showAt(this.el.getAlignToXY(el,pos||this.defaultAlign,this.defaultOffsets),parentMenu,false);
			}
		}else{
			Ext.menu.Menu.superclass.show.call(this);
		}
	},
	showAt:function(xy,parentMenu,_e){
		this.parentMenu=parentMenu;
		if(!this.el){
			this.render();
		}
		this.el.setXY(xy);
		if(this.enableScrolling){
			this.constrainScroll(xy[1]);
		}
		this.el.show();
		Ext.menu.Menu.superclass.onShow.call(this);
		if(Ext.isIE){
			this.layout.doAutoSize();
			if(!Ext.isIE8){
				this.el.repaint();
			}
		}
		this.hidden=false;
		this.focus();
		this.fireEvent("show",this);
	},
	constrainScroll:function(y){
		var max,full=this.ul.setHeight('auto').getHeight();
		if(this.floating){
			max=this.maxHeight?this.maxHeight:Ext.fly(this.el.dom.parentNode).getViewSize().height-y;
		}else{
			max=this.getHeight();
		}
		if(full>max&&max>0){
			this.activeMax=max-this.scrollerHeight*2-this.el.getFrameWidth('tb')-Ext.num(this.el.shadowOffset,0);
			this.ul.setHeight(this.activeMax);
			this.createScrollers();
			this.el.select('.x-menu-scroller').setDisplayed('');
		}else{
			this.ul.setHeight(full);
			this.el.select('.x-menu-scroller').setDisplayed('none');
		}
		this.ul.dom.scrollTop=0;
	},
	createScrollers:function(){
		if(!this.scroller){
			this.scroller={
				pos:0,
				top:this.el.insertFirst({
					tag:'div',
					cls:'x-menu-scroller x-menu-scroller-top',
					html:'&#160;'
				}),
				bottom:this.el.createChild({
					tag:'div',
					cls:'x-menu-scroller x-menu-scroller-bottom',
					html:'&#160;'
				})
			};
			this.scroller.top.hover(this.onScrollerIn,this.onScrollerOut,this);
			this.scroller.topRepeater=new Ext.util.ClickRepeater(this.scroller.top,{
				listeners:{
					click:this.onScroll.createDelegate(this,[null,this.scroller.top],false)
				}
			});
			this.scroller.bottom.hover(this.onScrollerIn,this.onScrollerOut,this);
			this.scroller.bottomRepeater=new Ext.util.ClickRepeater(this.scroller.bottom,{
				listeners:{
					click:this.onScroll.createDelegate(this,[null,this.scroller.bottom],false)
				}
			});
		}
	},
	onLayout:function(){
		if(this.isVisible()){
			if(this.enableScrolling){
				this.constrainScroll(this.el.getTop());
			}
			if(this.floating){
				this.el.sync();
			}
		}
	},
	focus:function(){
		if(!this.hidden){
			this.doFocus.defer(50,this);
		}
	},
	doFocus:function(){
		if(!this.hidden){
			this.focusEl.focus();
		}
	},
	hide:function(deep){
		this.deepHide=deep;
		Ext.menu.Menu.superclass.hide.call(this);
		delete this.deepHide;
	},
	onHide:function(){
		Ext.menu.Menu.superclass.onHide.call(this);
		this.deactivateActive();
		if(this.el&&this.floating){
			this.el.hide();
		}
		if(this.deepHide===true&&this.parentMenu){
			this.parentMenu.hide(true);
		}
	},
	lookupComponent:function(c){
		 if(Ext.isString(c)){
			c=(c=='separator'||c=='-')?new Ext.menu.Separator():new Ext.menu.TextItem(c);
			 this.applyDefaults(c);
		}else{
			if(Ext.isObject(c)){
				c=this.getMenuItem(c);
			}else if(c.tagName||c.el){
				c=new Ext.BoxComponent({
					el:c
				});
			}
		}
		 return c;
	},
	applyDefaults:function(c){
		if(!Ext.isString(c)){
			c=Ext.menu.Menu.superclass.applyDefaults.call(this,c);
			var d=this.internalDefaults;
			if(d){
				if(c.events){
					Ext.applyIf(c.initialConfig,d);
					Ext.apply(c,d);
				}else{
					Ext.applyIf(c,d);
				}
			}
		}
		return c;
	},
	getMenuItem:function(config){
	 if(!config.isXType){
			if(!config.xtype&&Ext.isBoolean(config.checked)){
				return new Ext.menu.CheckItem(config)
			}
			return Ext.create(config,this.defaultType);
		}
		return config;
	},
	addSeparator:function(){
		return this.add(new Ext.menu.Separator());
	},
	addElement:function(el){
		return this.add(new Ext.menu.BaseItem(el));
	},
	addItem:function(item){
		return this.add(item);
	},
	addMenuItem:function(config){
		return this.add(this.getMenuItem(config));
	},
	addText:function(text){
		return this.add(new Ext.menu.TextItem(text));
	},
	onDestroy:function(){
		Ext.menu.Menu.superclass.onDestroy.call(this);
		Ext.menu.MenuMgr.unregister(this);
		Ext.EventManager.removeResizeListener(this.hide,this);
		if(this.keyNav){
			this.keyNav.disable();
		}
		var s=this.scroller;
		if(s){
			Ext.destroy(s.topRepeater,s.bottomRepeater,s.top,s.bottom);
		}
	}});
Ext.reg('menu',Ext.menu.Menu);
Ext.menu.MenuNav=Ext.extend(Ext.KeyNav,function(){
	function up(e,m){
		if(!m.tryActivate(m.items.indexOf(m.activeItem)-1,-1)){
			m.tryActivate(m.items.length-1,-1);
		}
	}
	function down(e,m){
		if(!m.tryActivate(m.items.indexOf(m.activeItem)+1,1)){
			m.tryActivate(0,1);
		}
	}
	return{
		constructor:function(menu){
			Ext.menu.MenuNav.superclass.constructor.call(this,menu.el);
			this.scope=this.menu=menu;
		},
		doRelay:function(e,h){
			var k=e.getKey();
			if(this.menu.activeItem&&this.menu.activeItem.isFormField&&k!=e.TAB){
				return false;
			}
			if(!this.menu.activeItem&&e.isNavKeyPress()&&k!=e.SPACE&&k!=e.RETURN){
				this.menu.tryActivate(0,1);
				return false;
			}
			return h.call(this.scope||this,e,this.menu);
		},
		tab:function(e,m){
			e.stopEvent();
			if(e.shiftKey){
				up(e,m);
			}else{
				down(e,m);
			}
		},
		up:up,
		down:down,
		right:function(e,m){
			if(m.activeItem){
				m.activeItem.expandMenu(true);
			}
		},
		left:function(e,m){
			m.hide();
			if(m.parentMenu&&m.parentMenu.activeItem){
				m.parentMenu.activeItem.activate();
			}
		},
		enter:function(e,m){
			if(m.activeItem){
				e.stopPropagation();
				m.activeItem.onClick(e);
				m.fireEvent("click",this,m.activeItem);
				return true;
			}
		}
	};}());
Ext.menu.MenuMgr=function(){
var menus,active,groups={},attached=false,lastShow=new Date();
function init(){
	 menus={};
	 active=new Ext.util.MixedCollection();
	 Ext.getDoc().addKeyListener(27,function(){
		 if(active.length>0){
			 hideAll();
		}
	});}
function hideAll(){
	 if(active&&active.length>0){
		 var c=active.clone();
		 c.each(function(m){
			 m.hide();
		});
	}}
function onHide(m){
	 active.remove(m);
	 if(active.length<1){
		 Ext.getDoc().un("mousedown",onMouseDown);
		 attached=false;
	}}
function onShow(m){
	 var last=active.last();
	 lastShow=new Date();
	 active.add(m);
	 if(!attached){
		 Ext.getDoc().on("mousedown",onMouseDown);
		 attached=true;
	}
	 if(m.parentMenu){
		 m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"),10)+3);
		 m.parentMenu.activeChild=m;
	}else if(last&&last.isVisible()){
		 m.getEl().setZIndex(parseInt(last.getEl().getStyle("z-index"),10)+3);
	}}
function onBeforeHide(m){
	 if(m.activeChild){
		 m.activeChild.hide();
	}
	 if(m.autoHideTimer){
		 clearTimeout(m.autoHideTimer);
		 delete m.autoHideTimer;
	}}
function onBeforeShow(m){
	 var pm=m.parentMenu;
	 if(!pm&&!m.allowOtherMenus){
		 hideAll();
	}else if(pm&&pm.activeChild){
		 pm.activeChild.hide();
	}}
function onMouseDown(e){
	 if(lastShow.getElapsed()>50&&active.length>0&&!e.getTarget(".x-menu")){
		 hideAll();
	}}
function onBeforeCheck(mi,state){
	 if(state){
		 var g=groups[mi.group];
		 for(var i=0,l=g.length;i<l;i++){
			 if(g[i]!=mi){
				 g[i].setChecked(false);
			}
		}
	}}
return{
	 hideAll:function(){
			hideAll();
	},
	 register:function(menu){
		 if(!menus){
			 init();
		}
		 menus[menu.id]=menu;
		 menu.on("beforehide",onBeforeHide);
		 menu.on("hide",onHide);
		 menu.on("beforeshow",onBeforeShow);
		 menu.on("show",onShow);
		 var g=menu.group;
		 if(g&&menu.events["checkchange"]){
			 if(!groups[g]){
				 groups[g]=[];
			}
			 groups[g].push(menu);
			 menu.on("checkchange",onCheck);
		}
	},
	 get:function(menu){
		 if(typeof menu=="string"){
			 if(!menus){
				 return null;
			}
			 return menus[menu];
		}else if(menu.events){
			 return menu;
		}else if(typeof menu.length=='number'){
			 return new Ext.menu.Menu({items:menu});
		}else{
			 return Ext.create(menu,'menu');
		}
	},
	 unregister:function(menu){
		 delete menus[menu.id];
		 menu.un("beforehide",onBeforeHide);
		 menu.un("hide",onHide);
		 menu.un("beforeshow",onBeforeShow);
		 menu.un("show",onShow);
		 var g=menu.group;
		 if(g&&menu.events["checkchange"]){
			 groups[g].remove(menu);
			 menu.un("checkchange",onCheck);
		}
	},
	 registerCheckable:function(menuItem){
		 var g=menuItem.group;
		 if(g){
			 if(!groups[g]){
				 groups[g]=[];
			}
			 groups[g].push(menuItem);
			 menuItem.on("beforecheckchange",onBeforeCheck);
		}
	},
	 unregisterCheckable:function(menuItem){
		 var g=menuItem.group;
		 if(g){
			 groups[g].remove(menuItem);
			 menuItem.un("beforecheckchange",onBeforeCheck);
		}
	},
	 getCheckedItem:function(groupId){
		 var g=groups[groupId];
		 if(g){
			 for(var i=0,l=g.length;i<l;i++){
				 if(g[i].checked){
					 return g[i];
				}
			}
		}
		 return null;
	},
	 setCheckedItem:function(groupId,itemId){
		 var g=groups[groupId];
		 if(g){
			 for(var i=0,l=g.length;i<l;i++){
				 if(g[i].id==itemId){
					 g[i].setChecked(true);
				}
			}
		}
		 return null;
	}};}();
Ext.menu.BaseItem=function(config){
	Ext.menu.BaseItem.superclass.constructor.call(this,config);
	this.addEvents(
		'click',
		'activate',
		'deactivate'
	);
	if(this.handler){
		this.on("click",this.handler,this.scope);
	}};
Ext.extend(Ext.menu.BaseItem,Ext.Component,{
	canActivate:false,
	activeClass:"x-menu-item-active",
	hideOnClick:true,
	clickHideDelay:1,
	ctype:"Ext.menu.BaseItem",
	actionMode:"container",
	onRender:function(container,position){
		Ext.menu.BaseItem.superclass.onRender.apply(this,arguments);
		if(this.ownerCt&&this.ownerCt instanceof Ext.menu.Menu){
			this.parentMenu=this.ownerCt;
		}else{
			this.container.addClass('x-menu-list-item');
			this.mon(this.el,'click',this.onClick,this);
			this.mon(this.el,'mouseenter',this.activate,this);
			this.mon(this.el,'mouseleave',this.deactivate,this);
		}
	},
	setHandler:function(handler,scope){
		if(this.handler){
			this.un("click",this.handler,this.scope);
		}
		this.on("click",this.handler=handler,this.scope=scope);
	},
	onClick:function(e){
		if(!this.disabled&&this.fireEvent("click",this,e)!==false
				&&(this.parentMenu&&this.parentMenu.fireEvent("itemclick",this,e)!==false)){
			this.handleClick(e);
		}else{
			e.stopEvent();
		}
	},
	activate:function(){
		if(this.disabled){
			return false;
		}
		var li=this.container;
		li.addClass(this.activeClass);
		this.region=li.getRegion().adjust(2,2,-2,-2);
		this.fireEvent("activate",this);
		return true;
	},
	deactivate:function(){
		this.container.removeClass(this.activeClass);
		this.fireEvent("deactivate",this);
	},
	shouldDeactivate:function(e){
		return!this.region||!this.region.contains(e.getPoint());
	},
	handleClick:function(e){
		if(this.hideOnClick){
			this.parentMenu.hide.defer(this.clickHideDelay,this.parentMenu,[true]);
		}
	},
	expandMenu:Ext.emptyFn,
	hideMenu:Ext.emptyFn});
Ext.reg('menubaseitem',Ext.menu.BaseItem);
Ext.menu.TextItem=function(cfg){
	if(typeof cfg=='string'){
		cfg={text:cfg}
	}
	Ext.menu.TextItem.superclass.constructor.call(this,cfg);};
Ext.extend(Ext.menu.TextItem,Ext.menu.BaseItem,{
	hideOnClick:false,
	itemCls:"x-menu-text",
	onRender:function(){
		var s=document.createElement("span");
		s.className=this.itemCls;
		s.innerHTML=this.text;
		this.el=s;
		Ext.menu.TextItem.superclass.onRender.apply(this,arguments);
	}});
Ext.reg('menutextitem',Ext.menu.TextItem);
Ext.menu.Separator=function(config){
	Ext.menu.Separator.superclass.constructor.call(this,config);};
Ext.extend(Ext.menu.Separator,Ext.menu.BaseItem,{
	itemCls:"x-menu-sep",
	hideOnClick:false,
	activeClass:'',
	onRender:function(li){
		var s=document.createElement("span");
		s.className=this.itemCls;
		s.innerHTML="&#160;";
		this.el=s;
		li.addClass("x-menu-sep-li");
		Ext.menu.Separator.superclass.onRender.apply(this,arguments);
	}});
Ext.reg('menuseparator',Ext.menu.Separator);
Ext.menu.Item=function(config){
	Ext.menu.Item.superclass.constructor.call(this,config);
	if(this.menu){
		this.menu=Ext.menu.MenuMgr.get(this.menu);
	}};
Ext.extend(Ext.menu.Item,Ext.menu.BaseItem,{
	itemCls:'x-menu-item',
	canActivate:true,
	showDelay:200,
	hideDelay:200,
	ctype:'Ext.menu.Item',
	onRender:function(container,position){
		if(!this.itemTpl){
			this.itemTpl=Ext.menu.Item.prototype.itemTpl=new Ext.XTemplate(
				'<a id="{id}" class="{cls}" hidefocus="true" unselectable="on" href="{href}"',
					'<tpl if="hrefTarget">',
						' target="{hrefTarget}"',
					'</tpl>',
				'>',
					'<img src="{icon}" class="x-menu-item-icon {iconCls}"/>',
					'<span class="x-menu-item-text">{text}</span>',
				'</a>'
			);
		}
		var a=this.getTemplateArgs();
		this.el=position?this.itemTpl.insertBefore(position,a,true):this.itemTpl.append(container,a,true);
		this.iconEl=this.el.child('img.x-menu-item-icon');
		this.textEl=this.el.child('.x-menu-item-text');
		Ext.menu.Item.superclass.onRender.call(this,container,position);
	},
	getTemplateArgs:function(){
		return{
			id:this.id,
			cls:this.itemCls+(this.menu?' x-menu-item-arrow':'')+(this.cls?' '+this.cls:''),
			href:this.href||'#',
			hrefTarget:this.hrefTarget,
			icon:this.icon||Ext.BLANK_IMAGE_URL,
			iconCls:this.iconCls||'',
			text:this.itemText||this.text||'&#160;'
		};
	},
	setText:function(text){
		this.text=text||'&#160;';
		if(this.rendered){
			this.textEl.update(this.text);
			this.parentMenu.layout.doAutoSize();
		}
	},
	setIconClass:function(cls){
		var oldCls=this.iconCls;
		this.iconCls=cls;
		if(this.rendered){
			this.iconEl.replaceClass(oldCls,this.iconCls);
		}
	},
	beforeDestroy:function(){
		if(this.menu){
			this.menu.destroy();
		}
		Ext.menu.Item.superclass.beforeDestroy.call(this);
	},
	handleClick:function(e){
		if(!this.href){
			e.stopEvent();
		}
		Ext.menu.Item.superclass.handleClick.apply(this,arguments);
	},
	activate:function(autoExpand){
		if(Ext.menu.Item.superclass.activate.apply(this,arguments)){
			this.focus();
			if(autoExpand){
				this.expandMenu();
			}
		}
		return true;
	},
	shouldDeactivate:function(e){
		if(Ext.menu.Item.superclass.shouldDeactivate.call(this,e)){
			if(this.menu&&this.menu.isVisible()){
				return!this.menu.getEl().getRegion().contains(e.getPoint());
			}
			return true;
		}
		return false;
	},
	deactivate:function(){
		Ext.menu.Item.superclass.deactivate.apply(this,arguments);
		this.hideMenu();
	},
	expandMenu:function(autoActivate){
		if(!this.disabled&&this.menu){
			clearTimeout(this.hideTimer);
			delete this.hideTimer;
			if(!this.menu.isVisible()&&!this.showTimer){
				this.showTimer=this.deferExpand.defer(this.showDelay,this,[autoActivate]);
			}else if(this.menu.isVisible()&&autoActivate){
				this.menu.tryActivate(0,1);
			}
		}
	},
	deferExpand:function(autoActivate){
		delete this.showTimer;
		this.menu.show(this.container,this.parentMenu.subMenuAlign||'tl-tr?',this.parentMenu);
		if(autoActivate){
			this.menu.tryActivate(0,1);
		}
	},
	hideMenu:function(){
		clearTimeout(this.showTimer);
		delete this.showTimer;
		if(!this.hideTimer&&this.menu&&this.menu.isVisible()){
			this.hideTimer=this.deferHide.defer(this.hideDelay,this);
		}
	},
	deferHide:function(){
		delete this.hideTimer;
		if(this.menu.over){
			this.parentMenu.setActiveItem(this,false);
		}else{
			this.menu.hide();
		}
	}});
Ext.reg('menuitem',Ext.menu.Item);
Ext.menu.CheckItem=function(config){
	Ext.menu.CheckItem.superclass.constructor.call(this,config);
	this.addEvents(
		"beforecheckchange",
		"checkchange"
	);
	if(this.checkHandler){
		this.on('checkchange',this.checkHandler,this.scope);
	}
	Ext.menu.MenuMgr.registerCheckable(this);};
Ext.extend(Ext.menu.CheckItem,Ext.menu.Item,{
	itemCls:"x-menu-item x-menu-check-item",
	groupClass:"x-menu-group-item",
	checked:false,
	ctype:"Ext.menu.CheckItem",
	onRender:function(c){
		Ext.menu.CheckItem.superclass.onRender.apply(this,arguments);
		if(this.group){
			this.el.addClass(this.groupClass);
		}
		if(this.checked){
			this.checked=false;
			this.setChecked(true,true);
		}
	},
	destroy:function(){
		Ext.menu.MenuMgr.unregisterCheckable(this);
		Ext.menu.CheckItem.superclass.destroy.apply(this,arguments);
	},
	setChecked:function(state,suppressEvent){
		if(this.checked!=state&&this.fireEvent("beforecheckchange",this,state)!==false){
			if(this.container){
				this.container[state?"addClass":"removeClass"]("x-menu-item-checked");
			}
			this.checked=state;
			if(suppressEvent!==true){
				this.fireEvent("checkchange",this,state);
			}
		}
	},
	handleClick:function(e){
	 if(!this.disabled&&!(this.checked&&this.group)){
		 this.setChecked(!this.checked);
	}
	 Ext.menu.CheckItem.superclass.handleClick.apply(this,arguments);
	}});
Ext.reg('menucheckitem',Ext.menu.CheckItem);
Ext.menu.DateMenu=Ext.extend(Ext.menu.Menu,{
	enableScrolling:false,
	hideOnClick:true,
	cls:'x-date-menu',
	initComponent:function(){
		this.on('beforeshow',this.onBeforeShow,this);
		if(this.strict=(Ext.isIE7&&Ext.isStrict)){
			this.on('show',this.onShow,this,{single:true,delay:20});
		}
		Ext.apply(this,{
			plain:true,
			showSeparator:false,
			items:this.picker=new Ext.DatePicker(Ext.apply({
				internalRender:this.strict||!Ext.isIE,
				ctCls:'x-menu-date-item'
			},this.initialConfig))
		});
		this.picker.purgeListeners();
		Ext.menu.DateMenu.superclass.initComponent.call(this);
		this.relayEvents(this.picker,["select"]);
		this.on('select',this.menuHide,this);
		if(this.handler){
			this.on('select',this.handler,this.scope||this);
		}
	},
	menuHide:function(){
		if(this.hideOnClick){
			this.hide(true);
		}
	},
	onBeforeShow:function(){
		if(this.picker){
			this.picker.hideMonthPicker(true);
		}
	},
	onShow:function(){
		var el=this.picker.getEl();
		el.setWidth(el.getWidth());
	}});
Ext.reg('datemenu',Ext.menu.DateMenu);
Ext.menu.ColorMenu=Ext.extend(Ext.menu.Menu,{
	enableScrolling:false,
	hideOnClick:true,
	initComponent:function(){
		Ext.apply(this,{
			plain:true,
			showSeparator:false,
			items:this.palette=new Ext.ColorPalette(this.initialConfig)
		});
		this.palette.purgeListeners();
		Ext.menu.ColorMenu.superclass.initComponent.call(this);
		this.relayEvents(this.palette,['select']);
		this.on('select',this.menuHide,this);
		if(this.handler){
			this.on('select',this.handler,this.scope||this)
		}
	},
	menuHide:function(){
		if(this.hideOnClick){
			this.hide(true);
		}
	}});
Ext.reg('colormenu',Ext.menu.ColorMenu);
Ext.form.Field=Ext.extend(Ext.BoxComponent,{
	invalidClass:"x-form-invalid",
	invalidText:"The value in this field is invalid",
	focusClass:"x-form-focus",
	validationEvent:"keyup",
	validateOnBlur:true,
	validationDelay:250,
	defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"off"},
	fieldClass:"x-form-field",
	msgTarget:'qtip',
	msgFx:'normal',
	readOnly:false,
	disabled:false,
	isFormField:true,
	hasFocus:false,
	initComponent:function(){
		Ext.form.Field.superclass.initComponent.call(this);
		this.addEvents(
			'focus',
			'blur',
			'specialkey',
			'change',
			'invalid',
			'valid'
		);
	},
	getName:function(){
		return this.rendered&&this.el.dom.name?this.el.dom.name:this.name||this.id||'';
	},
	onRender:function(ct,position){
		if(!this.el){
			var cfg=this.getAutoCreate();
			if(!cfg.name){
				cfg.name=this.name||this.id;
			}
			if(this.inputType){
				cfg.type=this.inputType;
			}
			this.autoEl=cfg;
		}
		Ext.form.Field.superclass.onRender.call(this,ct,position);
		var type=this.el.dom.type;
		if(type){
			if(type=='password'){
				type='text';
			}
			this.el.addClass('x-form-'+type);
		}
		if(this.readOnly){
			this.el.dom.readOnly=true;
		}
		if(this.tabIndex!==undefined){
			this.el.dom.setAttribute('tabIndex',this.tabIndex);
		}
		this.el.addClass([this.fieldClass,this.cls]);
	},
	getItemCt:function(){
		return this.el.up('.x-form-item',4);
	},
	initValue:function(){
		if(this.value!==undefined){
			this.setValue(this.value);
		}else if(!Ext.isEmpty(this.el.dom.value)&&this.el.dom.value!=this.emptyText){
			this.setValue(this.el.dom.value);
		}
		this.originalValue=this.getValue();
	},
	isDirty:function(){
		if(this.disabled||!this.rendered){
			return false;
		}
		return String(this.getValue())!==String(this.originalValue);
	},
	afterRender:function(){
		Ext.form.Field.superclass.afterRender.call(this);
		this.initEvents();
		this.initValue();
	},
	fireKey:function(e){
		if(e.isSpecialKey()){
			this.fireEvent("specialkey",this,e);
		}
	},
	reset:function(){
		this.setValue(this.originalValue);
		this.clearInvalid();
	},
	initEvents:function(){
		this.mon(this.el,Ext.EventManager.useKeydown?"keydown":"keypress",this.fireKey,this);
		this.mon(this.el,'focus',this.onFocus,this);
		var o=this.inEditor&&Ext.isWindows&&Ext.isGecko?{buffer:10}:null;
		this.mon(this.el,'blur',this.onBlur,this,o);
	},
	onFocus:function(){
		if(this.focusClass){
			this.el.addClass(this.focusClass);
		}
		if(!this.hasFocus){
			this.hasFocus=true;
			this.startValue=this.getValue();
			this.fireEvent("focus",this);
		}
	},
	beforeBlur:Ext.emptyFn,
	onBlur:function(){
		this.beforeBlur();
		if(this.focusClass){
			this.el.removeClass(this.focusClass);
		}
		this.hasFocus=false;
		if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){
			this.validate();
		}
		var v=this.getValue();
		if(String(v)!==String(this.startValue)){
			this.fireEvent('change',this,v,this.startValue);
		}
		this.fireEvent("blur",this);
	},
	isValid:function(preventMark){
		if(this.disabled){
			return true;
		}
		var restore=this.preventMark;
		this.preventMark=preventMark===true;
		var v=this.validateValue(this.processValue(this.getRawValue()));
		this.preventMark=restore;
		return v;
	},
	validate:function(){
		if(this.disabled||this.validateValue(this.processValue(this.getRawValue()))){
			this.clearInvalid();
			return true;
		}
		return false;
	},
	processValue:function(value){
		return value;
	},
	validateValue:function(value){
		return true;
	},
	markInvalid:function(msg){
		if(!this.rendered||this.preventMark){
			return;
		}
		msg=msg||this.invalidText;
		var mt=this.getMessageHandler();
		if(mt){
			mt.mark(this,msg);
		}else if(this.msgTarget){
			this.el.addClass(this.invalidClass);
			var t=Ext.getDom(this.msgTarget);
			if(t){
				t.innerHTML=msg;
				t.style.display=this.msgDisplay;
			}
		}
		this.fireEvent('invalid',this,msg);
	},
	clearInvalid:function(){
		if(!this.rendered||this.preventMark){
			return;
		}
		this.el.removeClass(this.invalidClass);
		var mt=this.getMessageHandler();
		if(mt){
			mt.clear(this);
		}else if(this.msgTarget){
			this.el.removeClass(this.invalidClass);
			var t=Ext.getDom(this.msgTarget);
			if(t){
				t.innerHTML='';
				t.style.display='none';
			}
		}
		this.fireEvent('valid',this);
	},
	getMessageHandler:function(){
		return Ext.form.MessageTargets[this.msgTarget];
	},
	getErrorCt:function(){
		return this.el.findParent('.x-form-element',5,true)||
			this.el.findParent('.x-form-field-wrap',5,true);
	},
	alignErrorIcon:function(){
		this.errorIcon.alignTo(this.el,'tl-tr',[2,0]);
	},
	getRawValue:function(){
		var v=this.rendered?this.el.getValue():Ext.value(this.value,'');
		if(v===this.emptyText){
			v='';
		}
		return v;
	},
	getValue:function(){
		if(!this.rendered){
			return this.value;
		}
		var v=this.el.getValue();
		if(v===this.emptyText||v===undefined){
			v='';
		}
		return v;
	},
	setRawValue:function(v){
		return(this.el.dom.value=(Ext.isEmpty(v)?'':v));
	},
	setValue:function(v){
		this.value=v;
		if(this.rendered){
			this.el.dom.value=(Ext.isEmpty(v)?'':v);
			this.validate();
		}
		return this;
	},
	append:function(v){
		 this.setValue([this.getValue(),v].join(''));
	},
	adjustSize:function(w,h){
		var s=Ext.form.Field.superclass.adjustSize.call(this,w,h);
		s.width=this.adjustWidth(this.el.dom.tagName,s.width);
		if(this.offsetCt){
			var ct=this.getItemCt();
			s.width-=ct.getFrameWidth('lr');
			s.height-=ct.getFrameWidth('tb');
		}
		return s;
	},
	adjustWidth:function(tag,w){
		if(typeof w=='number'&&(Ext.isIE&&(Ext.isIE6||!Ext.isStrict))&&/input|textarea/i.test(tag)&&!this.inEditor){
			return w-3;
		}
		return w;
	}
	});